www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/12/19/09:11:15

From: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
To: DJGPP AT sun DOT soe DOT clarkson DOT edu
Date: Tue, 19 Dec 1995 13:30:13 GMT
Subject: array arg funny (2)

  I compiled this program:-

int zxcvbnm(int i, int j, double x[i][j]){int k; k=2; return 42;}

  with djgpp as C and as C++. C++ faulted thus:-

t$$.cc:1: `i' was not declared in this scope
t$$.cc:1: `j' was not declared in this scope
Segmentation violation in pointer 0x00000008 at d8:5cebc

EXCEPTION OCCURRED!  Information dumped to core file:
    "t$gccdbg"

  and C thus:-

C:\WORK>c:\djgpp\bin\gcc t$$.c
fake(.text+0xe2): undefined reference to `main'   /*** I know why that is ***/

  (1) Why the difference?
  (2) If I include this function in a C program, would it treat the bounds [i]
and [j] correctly in the declaration of x, as in Fortran?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019