www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/10/11/14:34:10

From: "Tim Nicholson" <T DOT J DOT Nicholson AT btinternet DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: posible bug in GCC syntax checker?
Date: Thu, 11 Oct 2001 19:13:02 +0100
Organization: Skyforce avionics Limited
Lines: 53
Message-ID: <9q4nm9$lc9$1@plutonium.btinternet.com>
NNTP-Posting-Host: host213-1-148-154.btinternet.com
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I think I have found a bug in the GCC syntax checker! When I compile the
following code, I get the message...

Warning: Passing arg 1 of draw_item from incompatible pointer type

------------- source code ---------
//Local function prototype
void draw_item(const int point_array[ ][2]);

//function main
int main(void)
{
int item[5][2];

   {some code to initialise item};
   draw_item(item);

   return;
}

//function draw_item
void draw_item(const int point_array[ ][2])
{
    {some code to draw a point_array};
}

----------- end of code --------

This seemed very strange so I tried changing the prototype to see if I could
understand what was happening. Eventually, I discovered that I no longer got
the warning when I defined the prototype as:

void draw_item(int (* const point_array) [2]);

Now, correct me if I am wrong, but is this not the same thing in practical
terms?

I do not understand why the compiler complains about the first definition.
Is it a GCC bug? I am using DJGPP GCC-2.95.2 : GNU C compiler binaries with
no compiler flags.


Thanks


Tim







- Raw text -


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