K
Kevin Bracey
In message <[email protected]>
It's valid in ISO C99, but not earlier versions.
Yes, for that specific example, barring syntax quirks (eg "sizeof (long)1"
will be parsed differently from "sizeof 1L").
This might not be:
(long)1000000000000 vs 1000000000000L
because the suffix only specifies a minimum size, and it will grow to
long long if necessary. The first form would truncate it back down to long,
even if it didn't fit.
C99 has "ll" or "LL" for long long.
Martin Johansen said:Hello
I was not able to find answers to there Qs on google or in the FAQ, so
here goes
Q1:
I refer to the question 2.10 in the FAQ
the following code compiled with gcc
(struct {int a; char* b; int c;}){1, "1", 'A'}.c
but is it valid ansi c?
It's valid in ISO C99, but not earlier versions.
Q2:
Are these equivalent?
(long)1 contra 1L
Yes, for that specific example, barring syntax quirks (eg "sizeof (long)1"
will be parsed differently from "sizeof 1L").
This might not be:
(long)1000000000000 vs 1000000000000L
because the suffix only specifies a minimum size, and it will grow to
long long if necessary. The first form would truncate it back down to long,
even if it didn't fit.
Q3:
I know of the following "constant classifiers" i.e. 1L
l and L, f and F, u and U
but are there more?
C99 has "ll" or "LL" for long long.