[comp.std.c] Order to pragma chaos

eru@tnvsu1.tele.nokia.fi (Erkki Ruohtula) (11/23/90)

In article <12570055@hpclscu.HP.COM> shankar@hpclscu.HP.COM (Shankar Unni) writes:
   Thus the only reasonable approach is to say that a "#pragma" can change the
   behavior of a program in really unspecified ways (unless you want to get
   into the business of standardizing specific pragmas, like Ada does).

I think that to some extent, this might be a good idea. The problem with
pragmas is that although many compilers have similar special features,
the ways to invoke them differ. Disabling structure alignment is a good
example. One compiler I know expects "#pragma noalign", another
"#pragma pack".

There could be a clearing-house where implementors could send questions
like "I want to add a special feature X. What kind of a pragma (if any) has
been used for it before? if none, I intend to use #pragma ZZZ".
The clearing-house would send back either a suggestion about an existing
pragma, or tell the implementor to go ahead with his own idea (and archive
it for later queries). It would have the process these queries fairly
quickly to be useful, but this is possible if we stick to the idea that
the implementors suggestions for new pragmas are accepted without worldwide
discussion.

Implementors would also be asked to report if they improve the pragma they got
(for example, in the pack case, adding an optional number to specify that data
must be aligned to offsets divisible by that number should be reported).
The collected pragmas would be viewed as recommendations, not part of the
standard.

I believe this kind of arrangement could reduce unnecessary incompatibility
in the areas that fall outside the scope of the standard.
--
Erkki Ruohtula     / Nokia Telecommunications
eru@tele.nokia.fi / P.O. Box 33 SF-02601 Espoo, Finland
Disclaimer: These are my private opinions and do not represent the position
            of Nokia Telecommunications.

libes@cme.nist.gov (Don Libes) (12/04/90)

In article <ERU.90Nov23145007@tnvsu1.tele.nokia.fi> eru@tnvsu1.tele.nokia.fi (Erkki Ruohtula) writes:
>There could be a clearing-house where implementors could send questions
>like "I want to add a special feature X. What kind of a pragma (if any) has
>been used for it before? if none, I intend to use #pragma ZZZ".
>The clearing-house would send back either a suggestion about an existing
>pragma, or tell the implementor to go ahead with his own idea (and archive
>it for later queries). It would have the process these queries fairly
>quickly to be useful, but this is possible if we stick to the idea that
>the implementors suggestions for new pragmas are accepted without worldwide
>discussion.
>
>Implementors would also be asked to report if they improve the pragma they got
>(for example, in the pack case, adding an optional number to specify that data
>must be aligned to offsets divisible by that number should be reported).
>The collected pragmas would be viewed as recommendations, not part of the
>standard.

Rex Jaeshke has written several articles titled "Pragmania" in the
Journal of C Language Translation.  The articles report the results
of implementors surveyed for the pragmas they support.

This is even better than the clearing-house concept you suggest, since
I can make the decisions rather than someone who doesn't know about my
peculiar environment.  Plus, by seeing other pragmas, I get a good
feel for how people are using pragmas in general.

Since Rex will probably continue to regularly update "Pragmania", I
encourage you to send him description of your pragmas (especially
those really obscene ones).

Don Libes          libes@cme.nist.gov      ...!uunet!cme-durer!libes

henry@zoo.toronto.edu (Henry Spencer) (12/05/90)

In article <8538@muffin.cme.nist.gov> libes@cme.nist.gov (Don Libes) writes:
>Rex Jaeshke has written several articles titled "Pragmania" in the
>Journal of C Language Translation...

Now, if only those also appeared in a journal more of us could afford...
(JCLT is impossibly expensive for almost anyone who doesn't have firm
institutional support for his interest in C.)
-- 
"The average pointer, statistically,    |Henry Spencer at U of Toronto Zoology
points somewhere in X." -Hugh Redelmeier| henry@zoo.toronto.edu   utzoo!henry