[net.micro.mac] help with sizeof

jayf@islenet.UUCP (Jay Fields) (08/23/85)

Just discovered that there does not seem to be a sizeof() function
in Hippo C level I or II.  This would sure be useful for passing
the number of elements to an array sorting function like
sort(arrayname,sizeof(array[])/sizeof(array[element0]))

Thanks in advance for any comments/ideas.

j fields
...!ihnp4!islenet!jayf

tim@callan.UUCP (Tim Smith) (08/27/85)

> Just discovered that there does not seem to be a sizeof() function
> in Hippo C level I or II.  This would sure be useful for passing

Level I was written in Pasadena, and when I was bored, I would go over
and hassle them about things I thought they were doing wrong.  I don't think
I would have missed a lack of sizeof.  Also, we once ran a set of C progrs
meant to test out pcc through Hippo level I, and there must have been
a sizeof in there somewhere!  ( no - I can't tell anyone where to get
the set of test programs. ).

Anyway, try all of the following, since I am not sure how they handle
builtin functions like sizeof -- they may have fucked up the parsing:

	sizeof x ;		/* where x is a variable */
	sizeof(x) ;
	sizeof( x ) ;
	sizeof (x) ;
	sizeof ( x ) ;
	sizeof(int) ;
	sizeof( int ) ;
	sizeof (int) ;
	sizeof ( int ) ;

If none of these work, give them a call.
-- 
					Tim Smith
				ihnp4!{cithep,wlbr!callan}!tim

jayf@islenet.UUCP (Jay Fields) (09/09/85)

> Just discovered that there does not seem to be a sizeof() function
> in Hippo C level I or II.  This would sure be useful for passing
> the number of elements to an array sorting function like
> sort(arrayname,sizeof(array[])/sizeof(array[element0]))
> 
> Thanks in advance for any comments/ideas.
> 
> j fields
> ...!ihnp4!islenet!jayf

Hippo C requires arrays of functions to be initialized thusly:

struct test {int time,code;} bench[7] {
     {140,20},
     {127,50},
     {88,40},
     {125,10},
     {68,70},
     {182,60},
     {148,30}
};

I understood that most compilers did not require the nesting of 
braces so long as the elements were declared in the correct 
order, and I did not realize (later on) that sizeof() was a
compile time feature.  More than one of us, in the class I was
taking, made this mistake.  

Hippo~C, it turns out, also requires the seven (bench[7]).  Other
compilers will figure out that there's suppose to be a seven there
and put one in on their own so to speak.

Once the Hippo people got back from the computer show I found
their support to be top notch.  How many software companies do 
you know who's technical types will answer the phone at all hours
of the night and early morning?

Aloha,
J Fields
....ihnp4!islenet!jayf