#pragma does only half the job (was Re: Pragma and noalias)
T. William Wells
bill at proxftl.UUCP
Fri Jul 8 19:46:46 AEST 1988
In article <23349 at think.UUCP>, barmar at think.COM (Barry Margolin) writes:
> In article <423 at proxftl.UUCP> bill at proxftl.UUCP (T. William Wells) writes:
> > A PRAGMA CAN NOT GIVE INFORMATION ABOUT THE PROGRAM THAT
> > THE COMPILER CAN'T FIGURE OUT FOR ITSELF.
>
> How does this restriction follow from what the standard says?
Because implementation defined means that you can change only a
very limited subset of things, i.e., those things labeled as
implementation defined in the standard. For example, the effect
of right shifting a signed number is implementation defined.
This means that you could write #pragmas like:
#pragma right_shift zero_fill
#pragma right_shift sign_fill
#pragma right_shift generate_abort
which would cause the interpretation of the right shift to
change. (By the way, since the standard says only that the
effect is implementation defined, any behaviour is allowable.
Thus my final example, where the compiler is being instructed to
create an abort instruction. This is a defect in the standard; I
sent in a nitpick about it, we'll see if it gets fixed.)
[B.T.W., another, possibly loose, interpretation of what the
standard says is that the existence of #pragma widens the range
of implementation-defined to include whatever you might want to
dream up. This ambiguity is the cause of the debate about what
can be done with #pragma.]
More information about the Comp.lang.c
mailing list