This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

ANSI compliance problem



In my quest to make my 1 C program ANSI compliant..i have a question..and
since it seems like it's common to cygwin only so far, I feel it's
relevant for here.
Say I have a char defined as "char mess[10];"
and I want to toupper mess[0] of it

I do mess[0]=toupper((int)mess[0]);
and include ctype.h

On linux, dec unix this works fine. No warning or anything.
On cygwinb20 (win95&win98) I get:

server.c:2680: warning: ANSI C forbids braced-groups within expressions

I've also tried *mess=toupper((int)*mess);
Putting () around *mess doesn't work either..The () inside the toupper()
is what the problem is, I think.
But I don't know how to pass it as int WITHOUT putting (int), short of
doing something like:
int upit;
upit=mess[0];
mess[0]=toupper(upit);

I don't really want to have to create a new int variable just for this.
The program works fine, I just want the warning gone and it to see it as
ANSI compliant.

I'm compiling with..
gcc -Wall -Wpointer-arith -Wcast-qual -Wcast-align -Waggregate-return
-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
-Wnested-externs -Winline -Wshadow -pedantic -o objs/server.o -c server.c

Please don't tell me to just not use all the -W options :-)

Thanx,

-Cygnus
.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-.
Anthony J. Biacco                       Network Administrator/Engineer
cygnus@ncohafmuta.com                    Intergrafix Internet Services

    "Dream as if you'll live forever, live as if you'll die today"
http://cygnus.ncohafmuta.com                http://www.intergrafix.net
.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-.



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]