Defect Report #005

Submission Date: 10 Dec 92
Submittor: WG14
Source: X3J11/90-020 (Walter J. Murray)
Question 1

According to subclause 6.8.6, a pragma directive ``causes the implementation to behave in an implementation-defined manner.'' May a conforming implementation define and recognize a pragma which would change the semantics of the language? For example, might a conforming implementation recognize and honor the directive

#pragma UNSIGNED_PRESERVING

as a way for a program to request non-standard integral promotions?

I also pose the corollary question. May a strictly conforming program contain a pragma directive? According to subclause 4, a strictly conforming program ``shall use only those features of the language ... specified in this standard. It shall not produce output dependent on any unspecified, undefined, or implementation-defined behavior...''

If there is no constraint on how a conforming implementation may behave when encountering a pragma directive, would it not follow that a strictly conforming program may not contain a pragma directive?

Response
The relevant citations are subclause 6.8.6:
A ... pragma ... causes the implementation to behave in an implementation-defined manner.
and clause 4:
A strictly conforming program ... shall not produce output dependent on any ... implementation-defined behavior ...
In response to each question:
  1. Yes, a conforming implementation may define and recognize a pragma which would change the semantics of the language.
  2. Yes, for example, it might honor UNSIGNED_PRESERVING.
  3. No, a strictly conforming program may not contain a pragma directive.
  4. We agree with your conclusion, reasserting answer number 3.
Previous Defect Report < - > Next Defect Report