Jim Bryant <kc5vdj.free...@gmail.com> wrote:

> well, i can't speak for K&R 1978, as i can't currently find my copy, 
> but, for a quick brush up, you might want to read pages 80 and 81
> from K&R 2nd Ed. 1988.
>
> your idea that the preprocessor will evaluate
>
> #define thirtytwok (1<<15)
>
> into 0x8000
>
> at compile time is totally incorrect, and in fact wouldn't be in 
> compliance with standards.  i have iso and fips handy, care for
> quotes?

Who said anything about the preprocessor?

The preprocessor is supposed to only do text substitutions, so you're
right that _it_ doesn't (or at least, shouldn't) replace (1<<15) with
0x8000.  The *compiler* does it.  Look up "constant expressions".

If you find a C compiler that generates a load and shift to evaluate
(1<<15) at runtime, your next move should be to file a bug report
with its maintainer -- unless you're dealing with a processor which
can do the load and shift in less time or space than a direct load
of 0x8000.

And BTW, please don't top-post.
_______________________________________________
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"

Reply via email to