Sujet : Re: relearning C: why does an in-place change to a char* segfault?
De : nntp (at) *nospam* fulltermprivacy.com (Phillip Frabott)
Groupes : comp.lang.cDate : 28. Sep 2024, 18:57:56
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vd9g34$1bmsp$1@dont-email.me>
References : 1
User-Agent : NewsLeecher v7.0 Final (http://www.newsleecher.com)
In reply to "Janis Papanagnou" who wrote the following:
On 28.09.2024 05:34, Keith Thompson wrote:
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
The more C is changed to resemble C++ the worse it becomes. It
isn't surprising that you like it.
For context, since the parent article is from a month and a half
ago, I was discussing a proposal to change a future C standard to
refer to "constants" as "literals". I mentioned that I think it's
a good idea.
I've heard of and seen various forms to name such entities...
- in a Pascal and an Eiffel book I find all these named "constants"
- in an Algol 68 book I read about "standard designations"
- in a book about languages and programming in general I find
"literals" ("abc"), "numerals" (42), "word-symbols" (false),
"graphemes" (�), etc., differentiated
- I've also have heard about "standard representations [for the
values of a respective type]"; also a type-independent term
I also think (for various reasons) that "constants" is not a good
term. (Personally I like terms like the Algol 68 term, that seems
to "operate" on another [more conceptual] abstraction level.)
But you'll certainly have to expect a lot of anger if the terminology
of some standards documents get changed from one version to another.
Janis
The only gripe I would have if we synonymized constants and literals is that not
every const is initialized with a literal. There have been times where I have
initialized a const from the value of a variable. I don't think that const and
literals are the same thing because of this.
To me a const is permanently set at initialization. That being runtime while a
literal is a hardcoded value that gets set at compile time.
There are cases where it does in fact matter, especially when a const is not
initialized with a literal but a var. It can also make a bigger difference when
someone actually needs to know when something is being set at compile time and
when it is being set at runtime. It can have a huge impact especially in edge
cases.
But thats just my 2 cents in the mix.
Have a good one!
Phillip Frabott
{Adam: Is a void really a void if it returns? - Jack: No, it's just nullspace at
that point.}
Phillip Frabott
{Adam: Is a void really a void if it returns? - Jack: No, it's just nullspace at
that point.}
-- ----------------------------------------- --- -- -Posted with NewsLeecher v7.0 FinalFree Newsreader @ http://www.newsleecher.com/------------------------------- ----- ---- -- -