Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.atnf.csiro.au/computing/software/gipsy/sub/present.dc2
Дата изменения: Wed Oct 5 18:40:19 1994
Дата индексирования: Fri Jan 16 18:18:46 2009
Кодировка:

Поисковые слова: п п п п п п п п п

Document: present

Purpose: Describes the use of undefined arguments in subroutine
and function calls.

Category: UTILITY

File: present.c

Author: K.G. Begeman

Description: To avoid the so called comma-comma construct which is
accepted by some (not ALL) fortran compilers, the
PRESENTN and PRESENTC routines were developped. These
routines check the address of the argument against
the address of a variable in a certain common block in
the calling routine. If the addresses are equal, i.e.
the value in the common block is passed as an argument
to the procedure, the argument is called undefined
(the same thing would be achieved by leaving out the
argument when the compiler accepts the comma-comma
construct). The common blocks reserved for this
solution are common /NOARGN/ for numeric variables and
common /NOARGC/ for character variables.
C programmers can use the 'standard' method of putting
the NULL pointer in the argument list for numeric
arguments or a (fchar) character string with address NULL
for character arguments.
The routines PRESENTN and PRESENTC return false if the
numeric or character argument is the first item in
resp. common /NOARGN/ or common /NOARGC/, otherwise
true is returned. Each of these routines is described
in more detail in their DC2 documents.

Warning: System dependent! At the moment it works on VMS, SUN,
CONVEX, HP 9000, SONY, DECstations, ALLIANT, ALPHA, CRAY
systems.

Updates: Jul 30, 1989: KGB, original document.
Apr 23, 1991: KGB, implemented for HP.
Sep 22, 1994: KGB, implemented for CRAY.