How to check if char pointer is a constant!?

"Daniel." <[email protected]> Thu, 7 Jul 2016 16:40:56 -0300
Newsgroups gmane.linux.c-programming
Message-ID <CAF3SDA6G32Kub4rK5BSmx7TkWoXnGWW2ESyHnM_+3t-naVPDww@mail.gmail.com>
Hi everybody,

I have some function, say
void empty(char *p) { p[0] = '\0'; }

If I call it like this empty("Hello") it will segfaults since "Hello"
is put in readonly section of the program. Is there a way to check for
this?! Maybe some nasty gcc extension!?

Regards,

-- 
"Do or do not. There is no try"
  Yoda Master
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html