Article View: comp.sys.ibm.pc.programmer
Article #921Re: `C' type question...
From: Neil Weisenfeld
Date: Tue, 10 Jul 1990 22:51
Date: Tue, 10 Jul 1990 22:51
33 lines
1605 bytes
1605 bytes
In article <26854@netnews.upenn.edu> weisen@eniac.seas.upenn.edu (Neil Weisenfeld) writes:
>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 ' '
>
And the winner is....
that person who told me to cast the ' ' to a char. K&R indicates that all
character constants are int's. Who ever said to make (*str) into
(*str == 0): didn't help. (also changes the sense of the expression).
Thanks for all of the responses.
Neil
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Neil I. Weisenfeld | InterNet: weisen@eniac.seas.upenn.edu
Dept. of Computer and Info. Sciences | USPS: I dunno, I'm moving...
University of Pennsylvania | PENNmail: Don't even try it...
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Technical Details
Message-ID:
<26917@netnews.upenn.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!rutgers!netnews.upenn.edu!eniac.seas.upenn.edu!weisenReferences:
<26854@netnews.upenn.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!rutgers!netnews.upenn.edu!eniac.seas.upenn.edu!weisen From: weisen@eniac.seas.upenn.edu (Neil Weisenfeld) Newsgroups: comp.sys.ibm.pc.programmer Subject: Re: `C' type question... Message-ID: <26917@netnews.upenn.edu> Date: 10 Jul 90 22:51:56 GMT References: <26854@netnews.upenn.edu> Sender: news@netnews.upenn.edu Reply-To: weisen@eniac.seas.upenn.edu.UUCP (Neil Weisenfeld) Distribution: usa Organization: University of Pennsylvania Lines: 33