TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: andrew clarke
from: Peter Collis
date: 1996-05-17 09:51:20
subject: casting non-void to void

-= Pete Replied to andrew clarke about: casting non-void to void =-

G'day andrew

 ac>> char *dest, *srce;
 ac>> strcpy(dest, srce);
 
 ac>> gives a warning but
 
 ac>> char *dest, *srce;
 ac>> (void) strcpy(dest, srce);
 
 ac>> does not ... ?
 
 PE> I think so, but not recently.  In my experience, lint, microsoft
 PE> c and cset/2 produce the most ridiculous errors known to man.

 PC> I can't comment on MSC but QC25 compiles the above without
 PC> warnings even with warning levels cranked up to 4 (full)

 ac> I should think so, as the two versions of the code are
 ac> effectively the same as far as any ANSI/ISO C compiler should be
 ac> concerned.  I wouldn't recommend running it though.  :-)

Well moving an unknown source to an unknown destination would sure
make for some interesting results :-), I thought the question was more
to do with having to cast the return from strcpy() to void to stop the
compiler generating a warning, i just commented that QC doesn't
require the void cast even at the highest warning level.

 ac> BTW, QuickC 2.5 is essentially the same as MSC 6.0, only MSC
 ac> supports OS/2 code generation and a few other advanced features.

True, also my version of QC also has the assembler QASM built in to
the IDE.

   -=Pete=-

--- OMX/Blue Wave v2.12
* Origin: Gates of Hell (3:713/914.16)
SEEN-BY: 50/99 620/243 623/630 711/401 409 410 413 430 808 809 932 934
SEEN-BY: 712/508 515 713/111 317 601 611 615 618 700 826 888 914 714/906
SEEN-BY: 800/1
@PATH: 713/914 615 888 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.