From: "Tim Nicholson" Newsgroups: comp.os.msdos.djgpp Subject: Re: posible bug in GCC syntax checker? Date: Fri, 19 Oct 2001 19:01:24 +0100 Organization: Skyforce avionics Limited Lines: 59 Message-ID: <9qppug$9pv$1@uranium.btinternet.com> References: <9q4nm9$lc9$1 AT plutonium DOT btinternet DOT com> NNTP-Posting-Host: host213-1-60-131.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 Yes, I had already discovered that it worked without the const. I always like to use const when passing a pointer argument to a function that is not designed to change it. That way I get a warning if, for whatever reason, the function or any other function down the line tries to write to the address. After all that is what const is for isn't it? I have visited a number of newsgroups with regard to this and It would seem that this is not a bug but an ANSI feature! I find it a real pain as it removes some of the flexibility that made C such a powerful programming tool. I do not use C++ in DJGPP but I do use Borland C++ Builder and VC++ when I have to :-( As you say, they do not exhibit this behaviour. I have heard some very reasoned arguments both for and against and I still remain unconvinced that this was really intentional. ANSI is meant to be a standard, but like many standards it does seem to be open to different interpretations and implementations. I have to write code that does not meet our company's most basic coding standards (i.e no const where ther should be one) in order to please the compiler - I doubt that is what the committee intended. I guess this is now a little of topic for here but, at the end of the day we all use DJGPP to compile our code. It was that implementation of the GCC compiler that produced the unexpected warning - so I do feel there is validity in the origional post at least. Now prehaps this topic should be left to the .lang. boys and girls :-) Tim "A. Sinan Unur" wrote in message news:Xns9137B8BB094D0ASINANUNUR AT 132 DOT 236 DOT 56 DOT 8... > "Tim Nicholson" wrote in > news:9q4nm9$lc9$1 AT plutonium DOT btinternet DOT com: > > > Warning: Passing arg 1 of draw_item from incompatible pointer type > > It probably isn't a bug with GCC although I am no expert in rules regarding > the decay of multi-dimensional arrays to pointers. Your code compiles > without warnings if const is removed. > > Note that the code also compiles without warnings if compiled as C++. > > The answer to your question is tied to these facts but I do not know what > the answer is. You may want to check with the folks on > comp.lang.c.moderated. > > sinan. > -- > -------------------------------- > A. Sinan Unur > http://www.unur.com/