segmentation fault ... SIGSEGV

I

Ingo Menger

Note that s is not a const char*.
Right.

Neither is the string literal.

That's the real failure, IMHO, since it certainly *is* a pointer to
characters that must not be altered via this pointer. Too bad one
learns that at runtime only, when the compiler already knew it.
The sheer number of people asking the very same question as the OP is
another hint that this kind of half-hearted support for const is at
least questionable.

If the string literal _was_ a const char*, the warning should come on
the initialization rather than the function call.

This would indeed be THE RIGHT THING (TM) to do.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,277
Latest member
VytoKetoReview

Latest Threads

Top