Re: GCC for i386 allows 'invalid suffix "f" on integer constant'
Re: GCC for i386 allows 'invalid suffix "f" on integer constant'
- Subject: Re: GCC for i386 allows 'invalid suffix "f" on integer constant'
- From: Eric Albert <email@hidden>
- Date: Fri, 20 Jan 2006 14:24:07 -0800
On Jan 20, 2006, at 2:16 PM, Dirk Stegemann wrote:
Am 20.01.2006 um 23:24 schrieb Chris Espinosa:
'2' is an integer literal, and only combinations of [ulUL] are
allowed for integer literals. '2' is an invalid floating literal,
as it has neither a fraction part nor an exponent. It cannot be
typed as a float with "F" because it is not a floating literal.
Use 2.F or 2.0F instead.
You're right, and those variants work fine.
But the problem isn't that {float f = 2f;} compiles or doesn't
compile, but that it behaves differently dependent on the -arch flag.
I still can't reproduce this.
ealbert4:~> cat test.c
#import <stdio.h>
int main(int argc, char *argv[]) {
float f = 2F;
return 0;
}
ealbert4:~> gcc -v
Using built-in specs.
Target: powerpc-apple-darwin8
Configured with: /private/var/tmp/gcc/gcc-5250.obj~10/src/configure --
disable-checking -enable-werror --prefix=/usr --mandir=/share/man --
enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg]
[^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --
build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 --
target=powerpc-apple-darwin8
Thread model: posix
gcc version 4.0.1 (Apple Computer, Inc. build 5250)
ealbert4:~> gcc -arch ppc -Wall -g -o test test.c
test.c:4:12: error: invalid suffix "F" on integer constant
test.c: In function 'main':
test.c:4: warning: unused variable 'f'
ealbert4:~> gcc -arch i386 -Wall -g -o test test.c
test.c:4:12: error: invalid suffix "F" on integer constant
test.c: In function 'main':
test.c:4: warning: unused variable 'f'
ealbert4:~>
-Eric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden