HP SunSoft Pascal 4.0 Bedienungsanleitung Seite 104

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 333
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 103
80 Pascal 4.0 Users Guide
5
Using the -xl Option
When you use the –xl option, variables and top-level procedures and
functions declared in the program unit default to private. Look at the
difference when you compile and execute shrvar_prog.p and
shrvar_mod.p with –xl. See the source code in “Sharing Public Variables”
on page 77.
Without –xl, the variable global in shrvar_mod.p is treated as public;
here, global is treated as private. Thus, the assignment:
global := global + 1;
is not reflected in shrvar_prog.p; instead, each file uses its own private copy
of global.
The following sections describe five ways of sharing variables and routines
across units when you compile your program with –xl.
Usingpublic var Declarations
The following examples uses the public attribute in the var declaration to
make global public when you compile your program with –xl.
The commands to compile and
execute shrvar_prog.p and
shrvar_mod.p with the –xl
option
hostname% pc -xl shrvar_prog.p shrvar_mod.p
shrvar_prog.p:
shrvar_mod.p:
Linking:
hostname% a.out
From MAIN, before PROC: 1
From PROC : 0
From MAIN, after PROC: 1
Seitenansicht 103
1 2 ... 99 100 101 102 103 104 105 106 107 108 109 ... 332 333

Kommentare zu diesen Handbüchern

Keine Kommentare