Re: Correct way to call execve?

[ Available lists | Index of freebsd-hackers | Month of Jul 2003 | Week of 21 Jul 2003 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Leo Bicknell <bicknell@ufp.org>
Date
21 Jul 2003 11:52:19
Subject
Re: Correct way to call execve?
Message-ID
20030721185217.GA60600@ussenterprise.ufp.org

In reply to
Replies
Referenced by

[ Hide this part ]
In a message written on Mon, Jul 21, 2003 at 11:24:43AM -0700, Tim Kientzle wrote:
> I was hoping that someone knew a standard way to
> say "yes, I really do mean to cast away that const,"
> akin to C++ const_cast.

I'm missing something here. You can do that, but you can't do that
with say "-Wcast-qual", which is basically a flag to say "I don't
care what the code says, tell me about those situations".

> Basically, there is no const-correct way to
> invoke execvp using literal strings for argv except
> to copy the strings. In particular, the
> FreeBSD implementation of popen(), for example, cannot be
> compiled with strict warnings.

Depends on what you call correct. "cc" compiles it quietly. "cc
-Wall" compiles quietly. "cc -ansi" compiles quietly. "cc -pedantic"
compiles quietly. Sure, there are options you can turn on that
show you these /warnings/, but that doesn't mean those options are
actually showing you problems with your code.

Just because you can run "cc -nostdlib" doesn't mean all code that
fails to compile is "broken", it means you used the wrong option.
Similarly, if you do things in your program that require constants
to not be, then turning on an option to warn you about that seems
a bit backwards as well.

--
Leo Bicknell - bicknell@ufp.org - CCIE 3440
PGP keys at http://www.ufp.org/~bicknell/
Read TMBG List - tmbg-list-request@tmbg.org, www.tmbg.org


[ Show this part (application/pgp-signature) ]

Elapsed time: 0.205 seconds