home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gossip.pyramid.com!olivea!spool.mu.edu!agate!ames!nsisrv!jagubox!jim
- From: jim@jagubox.gsfc.nasa.gov (Jim Jagielski)
- Newsgroups: comp.lang.c
- Subject: Auto. conversion of function arguments
- Message-ID: <1229@jagubox.gsfc.nasa.gov>
- Date: 9 Nov 92 13:06:40 GMT
- Sender: usenet@nsisrv.gsfc.nasa.gov (Usenet)
- Reply-To: jim@jagubox.gsfc.nasa.gov (Jim Jagielski)
- Organization: NASA/Goddard Space Flight Center
- Lines: 20
- Nntp-Posting-Host: jagubox.gsfc.nasa.gov
-
- I know that it's bad programming practise, but is the following "legal"?
-
- Assume you have a function that accepts a char parameter. Now we know
- that whenever an integral argument is passed by a function call, chars
- and shorts are promoted to int...
-
- Sooo... assuming you call a function that accepts 'char', is there any
- _real_ reason why you must cast shorts and ints to char in the function
- call itself? After all, the parameter always "arrives" at the function
- as an int, so it "appears" that another automatic conversion takes place:
- from the int that arrives to the type of the parameter (assuming that they
- are both of integral or floating types... I'm not talking about going from
- int to float or whatever)...
-
- True enuff (even if it _is_ bad practise)?
- --
- Jim Jagielski | "It is not I who am crazy...
- jim@jagubox.gsfc.nasa.gov | it is I who am MAD!"
- NASA/GSFC, Code 734.4 |
- Greenbelt, MD 20771 | - Ren
-