Hi Gaurav,
You could do this...
q = 4294967295U
Or you could use -std=iso9899:1999 (perhaps with -pedantic) for the compiler
to produce an error. Assuming you are using GCC 4.x.
Or if you *want* to allow that, you could do this...
-std=gnu99
I'm guessing as to which version of GCC you are usin
>
> > Hi Gaurav,
> >
> >> Please confirm which of the two outputs is correct and why is there
a
> > difference in the output of two versions of compiler?
> >
> > Both outputs are "correct".
> >
>
>
> No, the standard is entirely unambiguous:
>
> --
* Andreas Schwab <[EMAIL PROTECTED]> [050921 17:46]:
> "Gaurav Gautam, Noida" <[EMAIL PROTECTED]> writes:
> > Does -fshort-enum guides the size of enumeration type or the size of
> > enumerator constant ?
> An enumerator constant is not an object, thus it has no size of its own.
> Since the enumera
On Thursday 22 September 2005 19:31, Daniel Jacobowitz wrote:
> On Thu, Sep 22, 2005 at 12:50:39PM -0400, Robert Dewar wrote:
> > of course, but the behavior of a compiler with a special implementation
> > dependent switch is not specified by the standard! Switches can do any
> > amount of violence
On Thu, Sep 22, 2005 at 12:50:39PM -0400, Robert Dewar wrote:
> of course, but the behavior of a compiler with a special implementation
> dependent switch is not specified by the standard! Switches can do any
> amount of violence to the standard you like, the only requirement is
> that there be a d
Dave Korn wrote:
Please confirm which of the two outputs is correct and why is there a
difference in the output of two versions of compiler?
Both outputs are "correct".
No, the standard is entirely unambiguous:
of course, but the behavior of a compiler with a special implementation
de
John Love-Jensen <[EMAIL PROTECTED]> writes:
| Hi Dave, Daniel, and Gaurav,
|
| For C99, I stand corrected.
|
| For C89 or C++98, I think my statement is applicable.
No, for C++98 your statement is even more incorrect because
enumerators (the constants) are NOT of type int -- and that has been
Hi Gaby, Dave, Daniel, and Gaurav,
>This is incorrect and misleading.
I concur. I retract my previous statement, and direct
seekers-of-clarification to the previous posts that answered this issue. My
apologies for my confusion.
Sincerely,
--Eljay
Hi Dave, Daniel, and Gaurav,
For C99, I stand corrected.
For C89 or C++98, I think my statement is applicable. (But until I
double-check by reading those standards, take that with a grain of salt.)
For all three, having enum be an int (signed or unsigned) is legit of
course.
For all three, hav
John Love-Jensen <[EMAIL PROTECTED]> writes:
| Hi Gaurav,
|
| >Please confirm which of the two outputs is correct and why is there a
| difference in the output of two versions of compiler?
|
| Both outputs are "correct".
|
| (Neither output is compliant to the standard, of course, as -fshort-en
Original Message
>From: John Love-Jensen
>Sent: 22 September 2005 16:34
> Hi Gaurav,
>
>> Please confirm which of the two outputs is correct and why is there a
> difference in the output of two versions of compiler?
>
> Both outputs are "correct".
>
No, the standard is entirely unam
On Thu, Sep 22, 2005 at 10:34:19AM -0500, John Love-Jensen wrote:
> Hi Gaurav,
>
> >Please confirm which of the two outputs is correct and why is there a
> difference in the output of two versions of compiler?
>
> Both outputs are "correct".
>
> (Neither output is compliant to the standard, of c
Hi Gaurav,
>Please confirm which of the two outputs is correct and why is there a
difference in the output of two versions of compiler?
Both outputs are "correct".
(Neither output is compliant to the standard, of course, as -fshort-enums is
a deviation from the standard.)
Sincerely,
--Eljay
Gaurav Gautam, Noida wrote:-
> #include
> int main()
> {
>enum aa {
>a = 0, b =127 , c
>};
> printf("size = %d %d %d\n", sizeof(enum aa),sizeof(b),sizeof(c));
> printf("value= %d %d %d\n", a,b,c);
> return 0;
> )
>
> The output is
> size = 1 1 1
> value= 0 127 128
> when
>
> And
>
> size = 1 4 4
> value= 0 127 128
>
> when (GCC) 4.1.0 20050915 (experimental) is used with -fshort-enums.
>
> Which of the two output is standard confirming.?
>
>
> > -Original Message-
> > From: Daniel Jacobowitz [mailto:[EMAI
On Wed, Sep 21, 2005 at 10:54:56AM -0400, Robert Dewar wrote:
> Daniel Jacobowitz wrote:
> >
> >I'm not 100% sure what #3 means for enumerators whose value does not
> >fit in the range of "int", but it's pretty clear that the
> >implementation is not allowed to change the type of enumerators.
>
>
"Gaurav Gautam, Noida" <[EMAIL PROTECTED]> writes:
> Does -fshort-enum guides the size of enumeration type or the size of
> enumerator constant ?
An enumerator constant is not an object, thus it has no size of its own.
Since the enumerator constants are of type int, not the enum type,
-fshort-enu
Daniel Jacobowitz wrote:
I'm not 100% sure what #3 means for enumerators whose value does not
fit in the range of "int", but it's pretty clear that the
implementation is not allowed to change the type of enumerators.
Of course an implementation can do whatever it likes in response
to switches,
On Wed, Sep 21, 2005 at 07:03:49PM +0530, Gaurav Gautam, Noida wrote:
> Thanks for the reply,
>
> But why is there a difference in the output of same tc, with an old gcc
> compiler and a new version of compiler.
>
> Was there a bug in the earlier gcc.
>
> I have a doubt.
>
> Gcc manual says th
er 21, 2005 6:10 PM
> To: Gaurav Gautam, Noida
> Cc: gcc@gcc.gnu.org; [EMAIL PROTECTED]
> Subject: Re: No effect of -fshort-enums..is it a bug
>
> On Wed, Sep 21, 2005 at 05:46:58PM +0530, Gaurav Gautam, Noida wrote:
> > int main()
> > {
> > enum aa {
> &g
On Wed, Sep 21, 2005 at 05:46:58PM +0530, Gaurav Gautam, Noida wrote:
> int main()
> {
> enum aa {
> a = 0, b =127 , c
> };
>
> printf("size = %d %d %d\n", sizeof(a),sizeof(b), sizeof(c));
> printf("value= %d %d %d\n", a,b,c);
> return 0;
> }
>
Hi,
I have compiled a testcase
int main()
{
enum aa {
a = 0, b =127 , c
};
printf("size = %d %d %d\n", sizeof(a),sizeof(b), sizeof(c));
printf("value= %d %d %d\n", a,b,c);
return 0;
}
On gcc (GCC) 4.1.0 20050915 (experimental) with the followi
22 matches
Mail list logo