| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Tutorial questions? |
Hi George,
* Reply to message in "Personal Mail for Bill"
> So his bold assertation that a "const" qualified
> variable didn't use any
> memory still isn't true.
Yes. That's absolutely right, George.
> The compiler optimiser is
> free to treat it like
> a #define if, and only if, it is not volatile or it is
> not referenced by
> address, otherwise is is just a special case of a
> normal variable.
No. It's an identifier, George, but a const is never variable. If it is
volatile it may be involuntarily altered between sequence points, but is
constant at sequence points.
> As I see it "static, auto or allocated" as storage
> duration specifiers
> are compiler information, as they tell the compiler
> extra information
> about a variable. We'd better agree to differ here.
OK - but static has always the same address, auto is on the stack, and
allocated is usually memory assigned by one of the malloc siblings. I know
you know all this, George, so forgive me for mentioning them, but some of
the readers may not be so knowledgeable.
> Not so, as I see it. A variable type-qualified as
> "const" cannot be
> changed by the code, there is nothing to stop
> something else with
> access to the variable (in shared memory) changing the
> variable.
We will have to agree to differ here, too, George. You are calling
identifiers variables as if they were identical. In my view they are not.
All variables are identifiers but not all identifiers are variables.
> It is a
> way of saying that a value is read only, and allowing
> the compiler to
> trap any errors in the code involving writing to the
> code (and I've had
> to fight to find bugs in other languages and assembler
> where a variable
> was "changed" in the code but was in reality in ROM
> and so fixed in
> value. Such bugs take a lot of finding :-( ).
No arguments with any of that if it is your opinion, George - you are
fully entitled to it. I was only sticking to the facts and was careful in
what I said.
> I have situation in a commercial application where
> variables are
> correctly "volatile const" and that is on a very real
> machine (this one
> ).
Lovely to talk to you again, George. :-)
Best wishes,
Bill.
---
* Origin: Meerkats Anonymous (2:2504/200)SEEN-BY: 396/1 632/0 371 633/260 267 270 371 634/397 635/506 728 810 639/252 SEEN-BY: 670/218 @PATH: 2504/200 213 255/3 1 251/25 396/1 633/260 635/506 728 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.