delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/11/30/10:34:58

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT sourceware DOT cygnus DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Date: Tue, 30 Nov 1999 10:34:02 -0500 (EST)
From: Cygnus - Admin <cygnus AT ncohafmuta DOT com>
To: cygwin AT sourceware DOT cygnus DOT com
Subject: ANSI compliance problem
Message-ID: <Pine.LNX.4.10.9911301026230.20800-100000@clipons.ncohafmuta.com>
MIME-Version: 1.0

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 AT ncohafmuta DOT 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 AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019