On Mon, 28 Mar 2016 13:57:08 -0300
Emiliano Marini <emilianomarin...@gmail.com> wrote:

> char *p;
> p="01234";  /* skeezy, but makes the point */
> 
> Warning! Here "p" is pointing to nowhere, you don't know which memory
> locations are writing to.

Yeah, that's why I said "skeezy". But on some of compilers, you can
actually strcpy(p, "43210") and you will neither get a compile time
error nor a runtime one, because when p is in scope, it points to 6
bytes *somewhere*, even if on the stack.

Also, if you *know* p will only be as an input and will not be changed,
my syntax is OK, although a #define would be better.

SteveT

Steve Litt 
March 2016 featured book: Quit Joblessness: Start Your Own Business
http://www.troubleshooters.com/startbiz
_______________________________________________
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

Reply via email to