[comp.std.c] Macros: Meaningful or Myth?

decot@hpisod2.HP.COM (Dave Decot) (09/13/89)

Where in the dpANS is the term "macro" defined?

I find references to "the setjmp macro", and then find that "whether setjmp
is a macro or a function is unspecified", and then find out that "errno"
is to be a "macro" defined in <errno.h>.

I hope this doesn't mean the implementation has to use "#define" to
do something with errno.

Is it OK for an implementation to provide setjmp only as a real function?

Dave Decot

gwyn@smoke.BRL.MIL (Doug Gwyn) (09/14/89)

In article <11580017@hpisod2.HP.COM> decot@hpisod2.HP.COM (Dave Decot) writes:
>Where in the dpANS is the term "macro" defined?

Constraints on the use of the term appear all over 3.8, but "macro"
itself is a general computing term found in ANSI X3/TR-1-82 (see 1.6).

>I find references to "the setjmp macro", and then find that "whether setjmp
>is a macro or a function is unspecified", and then find out that "errno"
>is to be a "macro" defined in <errno.h>.

"It is unspecified whether errno is a macro or an identifier declared
with external linkage." (4.1.3)

The temporary use of the single word "macro" in part of the description
is for readability (and to remind you that it's not necessarily an
object identifier).  It must be understood in the light of the
additional description that clarifies this.

>I hope this doesn't mean the implementation has to use "#define" to
>do something with errno.

No, but it might, so a strictly conforming program should not for
example presume that errno is the identifier of an object.

>Is it OK for an implementation to provide setjmp only as a real function?

Sure.  That's why it is unspecified whether it is "really" a macro
or a function.