Converting FORTRAN to C

Mark Brader msb at lsuc.UUCP
Thu Jan 10 10:29:49 AEST 1985


> ... that feature of C that I love to hate:  ...the apparent
> and real semantics of array declarations are wildly at variance with
> each other.  The C compiler goes to great lengths to make 
> 
> 	int a[5][2];
> 
> look like
> 
> 	a ---->	(a1)	(a2)	(a3)	(a4)	(a5)
> 		  |	  |	  |	  |	  |
> 		  V	  V	  V	  V	  V
> 		(a1.1)	(a2.1)	(a3.1)	(a4.1)	(a5.1)
> 		(a1.2)	(a2.2)	(a3.2)	(a4.2)	(a5.2)
> 
> ...but `a' is really a constant and a1, a2, a3, a4, a5 have no objective
> existence at all.  This really galls me; ...

Sure they do; they just don't take up any memory.  They're pointer-valued
constants, just as a is itself.  a[2] is a constant, just as if it was
declared as   int (*a2)[2];  --Why shouldn't it be?

Mark Brader



More information about the Comp.lang.c mailing list