Re: Why is argv not pointing to const?



Keith Thompson wrote:
Martin <martindotunderscoreobrien@xxxxxxxxxx> writes:
On Sat, 01 Mar 2008 21:43:34 -0000, Keith Thompson <kst-u@xxxxxxx> wrote:
Probably lint (note that there are a number of lint
implementations) is issuing this message because
your code didn't happen to modify these pointers.
What happens if you change your function's name
from "main" to something else?
I get the same message from Lint.

I am using PC-lint for C/C++ (NT) Ver. 8.00L, with the options -W
-ansi -pedantic -Wall.

So it looks like PC-lint is recommending that anything that your code
doesn't happen to modify should be declared as const (not bad advice
IMHO), but it's not allowing for the fact that the "main" function is
a special case.

Seems to me that `const' is appropriate only if the
non-modification is part of the "contract" or "interface"
of the function. The fact that today's version of the
function doesn't modify something is not necessarily a
promise that tomorrow's version will do likewise. Take
lint's advice as advice, not as a command.

In fact, that's the way to approach all of lint's
advice. Lint's job is to be a Nervous Nellie, to see a
lurking felon in every shadow and a goblin hiding beneath
every bed. Many of the felons and goblins will turn out
to be imaginary, but it behooves you to shine a few lights
in the shadows and poke under the beds with broomsticks,
just in case. See also the First Commandment at

http://www.lysator.liu.se/c/ten-commandments.html

--
Eric Sosman
esosman@xxxxxxxxxxxxxxxxxxxx
.



Relevant Pages

  • Re: Macro to delete rows
    ... just modify your formula to return a blank. ... I have a nnumber of projects each with a number of other data items next to ... Any advice would be very much appreciated! ...
    (microsoft.public.excel.misc)
  • Re: Programmatically producing certificate in .pfx format in .NET
    ... And who else, if not You, could give me the right advice on where ... >> cannot modify, especially when I do not know how it works inside. ... > If you really want to use the plain windows API though, ... > If you want "you should do this and this to accomplish your goal" then ...
    (microsoft.public.dotnet.framework)
  • Re: Programmatically producing certificate in .pfx format in .NET
    ... And who else, if not You, could give me the right advice on where ... >> cannot modify, especially when I do not know how it works inside. ... > If you really want to use the plain windows API though, ... > If you want "you should do this and this to accomplish your goal" then ...
    (microsoft.public.dotnet.framework)
  • Re: Using Allen Brownes calendar in an event procedure
    ... Allen, following your advice, I looked your example much more ... and I succeeded to modify it the way I wanted to! ... Dave and Douglas for the time you spent helping ...
    (microsoft.public.access.modulesdaovba)