How ANSI is Apollo's cc 6.7 (SR 10.2)

Karl Heuer karl at haddock.ima.isc.com
Wed Sep 12 09:43:30 AEST 1990


In article <13798 at smoke.BRL.MIL> gwyn at smoke.BRL.MIL (Doug Gwyn) writes:
>In article <15434 at reed.UUCP> minar at reed.bitnet (Nelson Minar) writes:
>>[someone's stdio says:] unsigned char *_ptr #attribute[aligned(1)];
>>Just what is '#attribute' supposed to mean? I assume it is supposed to be
>>picked up by the preprocessor, but isn't that what #pragma is for?
>
>Apparently Apollo thought they needed finer-grained control than the
>statement-oriented #pragma directive provides.  [It's legal, unless it
>collides with the ANSI `#' stringizing operator.]

A safer solution would have been to use a double-underscore keyword instead.
Gcc does this.  (And the documentation notes that since they are equally legal
but `__' is more flexible, there's no reason to support any `#pragma's.)

>>(from string.h - this is wrapped inside of an '#ifdef __STDC__')
>>extern char *strcpyn(...);
>
>Actually, this should be EXCLUDED when __STDC__ is in effect, since
>the C standard prohibits inclusion of arbitrary junk in standard
>headers for a conforming (__STDC__) implementation.

But it isn't arbitrary junk: `str*' is part of the reserved namespace
associated with <string.h>, so this would seem to be legal.  I'd guess this is
probably the equivalent of the `vstrcat' function in the FAQ, and the vendor
declared it with zero fixed arguments to avoid having to special-case the
first string in the actual implementation.

Karl W. Z. Heuer (karl at kelp.ima.isc.com or ima!kelp!karl), The Walking Lint



More information about the Comp.std.c mailing list