A nice macro

michael.p.lindner mpl at cbnewsl.ATT.COM
Fri Jun 23 04:15:36 AEST 1989


In article <2784 at solo8.cs.vu.nl>, maart at cs.vu.nl (Maarten Litmaath) writes:
> An often-heard complaint by Pascal dweebs on C is the absence of the
> equivalence of
	.
	.
	.
> 	bar	_foo[HIGH - LOW + 1];
> 
> 	#define		foo		(_foo - LOW)
	.
	.
	.
> There's only one (small) objection: name space pollution - an invisible
> extra identifier `_foo' is needed.

I can think of another objection.  The C convention that the address of the
first element of an array == its name.  Not to mention that this "foo" can
no longer be passed to sizeof().  And I'm sure some cleverer people will
notice that "foo" may not be calculable in some implementations of C, since
it involves an address BEFORE the actual start of an array.

Mike Lindner
attunix!mpl
AT&T Bell Laboratories
190 River Rd.
Summit, NJ 07901



More information about the Comp.lang.c mailing list