long long extended type in c89?

J

j

Sadly, I don't have a copy of the c89 standard, just a copy of the c99
standard. I was curious if in c89, the type ``long long'' is indeed
considered an extended type that may or may not be implemented by the
implementation? And if it states whether or not the size of ``long
long'' is equal to the size of ``long'' or can be greater than the
size there-of?
 
K

Kevin Easton

Jack Klein said:
The original C standard, as well as the C99 standard, allow a
conforming implementation to provide extensions as long as they do not
impact any strictly conforming program.

Using the keyword long twice within one declaration is an error in a
pre-C99 keyword, so an implementation is free to provide a type named
"long long" as an extension. Since it is completely an extension, it
can be anything at all that the implementation wants it to be.

I believe, as a syntax error, that it must be diagnosed.

- Kevin.
 
J

j

Jack Klein said:
The original C standard, as well as the C99 standard, allow a
conforming implementation to provide extensions as long as they do not
impact any strictly conforming program.

Using the keyword long twice within one declaration is an error in a
pre-C99 keyword, so an implementation is free to provide a type named
"long long" as an extension. Since it is completely an extension, it
can be anything at all that the implementation wants it to be.

Prior to C99, there was a DR that stated that no standard integer type
could be "longer" than long, i.e., size_t, ptrdiff_t, and so on. But
a "long long" type in a pre-C99 compiler would be an extension, not a
standard type, and the only limitation placed on extensions is the one
above.


That is what I was looking for. Thanks Jack. :)
 
J

Jack Klein

I believe, as a syntax error, that it must be diagnosed.

- Kevin.

Look at paragraphs 4 and 5 of Section 4 (C99):

"A strictly conforming program shall use only those features of the
language and library specified in this International Standard."

---and---

"A conforming implementation may have extensions (including additional
library functions), provided they do not alter the behavior of any
strictly conforming program."

I would say that a program containing a syntax error is *NOT* a
strictly conforming program (first quotation). Therefore a conforming
implementation is free to make an extension out of something that
would otherwise be a syntax error.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
 
K

Kevin Easton

Jack Klein said:
Look at paragraphs 4 and 5 of Section 4 (C99):

"A strictly conforming program shall use only those features of the
language and library specified in this International Standard."

---and---

"A conforming implementation may have extensions (including additional
library functions), provided they do not alter the behavior of any
strictly conforming program."

I would say that a program containing a syntax error is *NOT* a
strictly conforming program (first quotation). Therefore a conforming
implementation is free to make an extension out of something that
would otherwise be a syntax error.

I point you to Section 5 (I'm quoting here from N869):

5.1.1.3 Diagnostics
1 A conforming implementation shall produce at least one diagnostic
message (identified in an implementation-defined manner) if a
preprocessing translation unit or translation unit contains a violation
of any syntax rule or constraint, even if the behavior is also
explicitly specified as undefined or implementation-defined. Diagnostic
messages need not be produced in other circumstances.

(So an implementation can indeed provide a long long type, but it has to
say something like "Warning: You used the long long type!").

- Kevin.
 
P

Peter Shaggy Haywood

Groovy hepcat j was jivin' on 23 Aug 2003 15:54:02 -0700 in
comp.lang.c.
long long extended type in c89?'s a cool scene! Dig it!
Sadly, I don't have a copy of the c89 standard, just a copy of the c99
standard. I was curious if in c89, the type ``long long'' is indeed
considered an extended type that may or may not be implemented by the
implementation? And if it states whether or not the size of ``long
long'' is equal to the size of ``long'' or can be greater than the
size there-of?

It is not mentioned at all in C89.

--

Dig the even newer still, yet more improved, sig!

http://alphalink.com.au/~phaywood/
"Ain't I'm a dog?" - Ronny Self, Ain't I'm a Dog, written by G. Sherry & W. Walker.
I know it's not "technically correct" English; but since when was rock & roll "technically correct"?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top