const debacle
Janice Caron
caron800 at googlemail.com
Mon Mar 24 08:57:07 PDT 2008
On 24/03/2008, Bill Baxter <dnewsgroup at billbaxter.com> wrote:
> ...And this:
>
> char* substring(int begin, const char* string)
> {
> return string+begin;
> }
>
> char * foo = "hi there\n";
> char * bar = substring(3, foo);
>
> compiles in C
I'd call that a bug in your C compiler, because if that compiles, so
will the following:
void f(char const * s)
{
char * t = substring(0, f);
t[0] = 'x';
}
More information about the Digitalmars-d
mailing list