At 3:24 PM +0200 on 7/22/99, M. Uli Kusterer wrote:
>>But, for the record, use 0x4d415020ul for 'MAP '.
>
>I've created the following macro for types:
>
>#define BLOCK_TYPE( a,b,c,d ) ((unsigned long)(d | (c << 8) | (b
><< 16) | (a << 24)))
>
>Which should solve the problem. I use this whenever defining a constant for
>block type.
Not quite. Characters may be signed or unsigned, so:
#define BLOCK_TYPE(a,b,c,d) ((unsigned long)(((d) & 0xFF) |\
(((c) & 0xFF) << 8) |\
(((b) & 0xFF) << 16)|\
(((a) & 0xFF) << 24)
Otherwise, some characters would sign-extend, and could wind up with:
0xFFFFFFxx where xx is any hex constant >= 0x80
for input 0,0,0,0x80
Also, macro arguments are best inside parentheses, less someone screws up
the order of evaluation by doing something like (I'd have to check how
these evaluate)
BLOCK_TYPE('a'-'b','c','d','e')
BLOCK_TYPE('a'&&'b','c','d','e')
>
>>Ok. You made me thing there was something there I was missing...
>
> maybe that typo in "think" ? <g> ... couldn't resist
You havn't hear about THING(tm)?! Where have you been?! <g>
>
>>Why not just use a dang enum or some defines?! What's with the structs?
>
> there's only arrays, no structs. The advantage is that you can add a new
>type w/o problems and my code just indexes the array.
Yeh, well, Interpreter only needs one define.
>
>>
>>I must not of compiled HelloWorld.cpp...don't know how...I'll have to try
>>again.
>
> May I return that rock to you? Might be a good place to hide under after
>that mistake :-)
I figured out why. There is no HelloWorld.cpp. It's called
"HelloWorld.cp"... and I said to compile "*.cpp"
I'll recompile and try it.