🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc.programmer
Article #923

Re: `C' type question...

#923
From: Kevin D. Quitt
Date: Tue, 10 Jul 1990 16:22
33 lines
1427 bytes
In article <26854@netnews.upenn.edu> weisen@eniac.seas.upenn.edu (Neil Weisenfeld) writes:
>Maybe I should read K&R a little more thoroughly before posting this, but...
>
>Why does the following segment of code give a conversion between
>integral types warning under MSC6.00?
>
>void strmem(char *mem, char *str, int n)
>{
>  if (str && mem)
>    while (n--)
>      *mem++=(*str)?(*str++):ACTUAL_SPACE;
>}
>
>where ACTUAL_SPACE is defined:
>
>#define ACTUAL_SPACE ' '
>

    The ? operator evaluates as type int unless explicity cast.  When in
doubt as to the source of a warning, try putting each component of the
statement on a different line:

      *mem++=
(*str)?
(*str++):
ACTUAL_SPACE;
-- 
 _
Kevin D. Quitt         demott!kdq   kdq@demott.com
DeMott Electronics Co. 14707 Keswick St.   Van Nuys, CA 91405-1266
VOICE (818) 988-4975   FAX (818) 997-1190  MODEM (818) 997-4496 PEP last

                96.37% of all statistics are made up.
Technical Details
Message-ID: <386@demott.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!ncar!zaphod.mps.ohio-state.edu!usc!srhqla!demott!kdq
References: <26854@netnews.upenn.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!ncar!zaphod.mps.ohio-state.edu!usc!srhqla!demott!kdq
From: kdq@demott.COM (Kevin D. Quitt)
Newsgroups: comp.sys.ibm.pc.programmer
Subject: Re: `C' type question...
Message-ID: <386@demott.COM>
Date: 10 Jul 90 16:22:13 GMT
References: <26854@netnews.upenn.edu>
Reply-To: kdq@demott.COM (Kevin D. Quitt)
Distribution: usa
Organization: DeMott Electronics Co., Van Nuys CA
Lines: 33