🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #52401

Re: Constant pointers with ANSI C

#52401
From: David Kastrup
Date: Sun, 18 Oct 1992 18:08
26 lines
1363 bytes
surendar@wpi.edu (Surendar C.) writes:

>Thanks to all who helped me clarify that char const * == const char *.
>But I still don't get why the warning is given for one line and not the other.
>Is the increment operator ++ any different from += 1;. I compiled this
>under gcc 2.1 (-ansi -pedantic)

>Thanks for any help
>surendar

>int length(const char *const str)
>{
>	int count = 0;

>	while(*str)
>	{
>		str += 1; /* Get a warning here */
>		str++;    /* Get no warning here */
>		count++;
>	}

>	return(count);
>}
Well, either it is a compiler bug, or GNU simply does only warn about
the first such violation. If you remove the first line, does the
second still not trigger the warning?
Technical Details
Message-ID: <dak.719431686@rama>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!Urmel.Informatik.RWTH-Aachen.DE!rama!dak
References: <1bk3naINNrvi@bigboote.WPI.EDU>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,9fe2ac15040d6585
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1992-10-18 07:17:04 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!Urmel.Informatik.RWTH-Aachen.DE!rama!dak
From: dak@rama.informatik.rwth-aachen.de (David Kastrup)
Subject: Re: Constant pointers with ANSI C
Message-ID: <dak.719431686@rama>
Sender: news@Urmel.Informatik.RWTH-Aachen.DE (Newsfiles Owner)
Nntp-Posting-Host: rama
Organization: Rechnerbetrieb Informatik  /  RWTH Aachen
References: <1bk3naINNrvi@bigboote.WPI.EDU>
Date: 18 Oct 92 18:08:06 GMT
Lines: 26