TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: All
from: andrew clarke
date: 1996-04-30 16:14:00
subject: casting non-void to void

Has anyone experienced the sort of compiler behaviour Vince mentions?  eg.

  char *dest, *srce;
  strcpy(dest, srce);

gives a warning but

  char *dest, *srce;
  (void) strcpy(dest, srce);

does not ... ?

* Forwarded from BINKLEY by andrew clarke (3:635/727.4{at}fidonet).
* Originally by: Vince Perriello (1:343/491), 23 Apr 96 22:00.
* Originally to: andrew clarke (3:635/727.4).

---------- Forwarded message ----------
 ac> (void) load_language ();

 ac> ^^^^^^

 ac> I don't understand the purpose of the (void) prefix here.
 ac> There are whole bunch of (void) prefixes in front of calls
 ac> to sprintf(), time(), ...

Some compilers complain if you don't cast the return of a nonvoid function
to (void) when you're not using the return.

Part of the price you pay for working with a dozen or so compilers (and counting).

-+- Msgedsq/2 2.2e
 + Origin: If it wasn't FREE you paid too much. (1:343/491)

--- Msgedsq/2 3.38
* Origin: Blizzard of Ozz, Melbourne, Australia (3:635/727.4{at}fidonet)
SEEN-BY: 50/99 78/0 620/243 623/630 632/349 635/503 544 727 637/106 711/401
SEEN-BY: 711/409 410 413 430 808 809 932 934 712/515 713/888 714/906 800/1
SEEN-BY: 7877/2809
@PATH: 635/727 544 50/99 711/808 809 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™.