Velocity Reviews > Beginner's question

# Beginner's question

Wong
Guest
Posts: n/a

 01-11-2005
Hi gurus,

This macro does not look like a common one. Is this a function ?

#define Uint16(value) Uint8(value) , Uint8(value << 1)

dandelion
Guest
Posts: n/a

 01-11-2005

"Wong" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Hi gurus,
>
> This macro does not look like a common one. Is this a function ?
>
> #define Uint16(value) Uint8(value) , Uint8(value << 1)

Nope. It's a macro. Anything which is '#defined' is.

Richard Bos
Guest
Posts: n/a

 01-11-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) (Wong) wrote:

> This macro does not look like a common one. Is this a function ?
>
> #define Uint16(value) Uint8(value) , Uint8(value << 1)

No, it's a function-like macro. It takes one parameter, and expands to
the text behind it with "value" replaced by that parameter. For example:

a=Uint16(24);

is expanded to

a=Uint8(24) , Uint8(24 << 1);

in which both Uint8's are probably macros as well, so they would now be
expanded, too.

This does not look like a very useful macro to me, but it is a macro all
the same.

Richard

Flash Gordon
Guest
Posts: n/a

 01-11-2005
dandelion wrote:
> "Wong" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) om...
>
>>Hi gurus,
>>
>> This macro does not look like a common one. Is this a function ?
>>
>> #define Uint16(value) Uint8(value) , Uint8(value << 1)

>
> Nope. It's a macro. Anything which is '#defined' is.

It looks to me like it is also probably wrong, as well as being bad
style for not being spelled in upper case.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.