l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
October 20: Web Application Hacking: How to Make and Break Security on the Web
Next Installfest:
TBD
Latest News:
Oct. 10: LUGOD Installfests coming again soon
Page last updated:
2002 Jan 15 18:53

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] totally confused about C promotion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] totally confused about C promotion



On Mon, Jan 14, 2002 at 03:16:18PM -0800, Peter Jay Salzman wrote:
> from kernighan and ritchie, page 45:
> 
>   For example, the library routine sqrt expects a double argument, and
>   will produce nonsense if inadvertantly handed something else.
> 

<snip>

> what happens when you hand a long double to a math function which
> expects a double?  i can't find any rules for "demotion" in K+R.
> does code2.c work by accident or is there a concept of demoting floating
> points to a narrower width when the function expects them to be
> narrower?

Do you have the "old" K&R, or the second edition?  The old one was
before prototypes were invented, so it'd make sense for them to say
something like that.  Prototypes will force the argument to be the
correct type, automatically converting them.  Of course, this doesn't
apply to variadic functions such as the printf() examples.

Micah
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Sunset Systems
Who graciously hosts our website & mailing lists!