C Board  

Go Back   C Board > Platform Specific Boards > Linux Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 02-03-2002, 09:48 PM   #1
Registered User
 
Join Date: Feb 2002
Posts: 3
dollar sign is legal in gcc

hi,

consider this:

#include <iostream.h>

int main()
{
int $one;

cout << $one;
return 0;
}

i've tried this code on bcc 5.5 and it does not compile, but on gcc 2.95 (on linux) it compiles perfectly. why?
sourcerer is offline   Reply With Quote
Old 02-04-2002, 07:05 AM   #2
B26354
 
Deckard's Avatar
 
Join Date: Jan 2002
Posts: 631
GG is correct. The '$' character may not be part of an identifier under ANSI C. You can force gcc to adhere strictly to ANSI C by using the -ansi switch in your compiles. What you lose with the -ansi switch are the keywords asm, inline, and typeof (as well as some macros). The gcc man page has all the details.
__________________
Jason Deckard
Deckard is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Profiler Valgrind afflictedd2 C++ Programming 4 07-18-2008 09:38 AM
Compiles on gcc 3.3 but not on gcc 4.0.3 cunnus88 C++ Programming 5 03-29-2007 12:24 PM
My own itoa() maxorator C++ Programming 18 10-15-2006 11:49 AM
Can't get output to display dollar sign carolsue2 C++ Programming 5 02-28-2006 12:10 PM
gcc DavidP A Brief History of Cprogramming.com 21 10-22-2003 03:46 PM


All times are GMT -6. The time now is 07:39 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22