IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Because it's not supposed to be modified...
...i'd suspect that it's also not kosher to dereference a Const pointer. If a dereference is allowed then the program can backdoor a method to change the value by casting it to another type and then doing an assign.

Perhaps that's the point of the error message that Scott received?
New Yes, I remember all that..
..but why bother? I know what I'm doing when I call a C function - it's pedantic and *against C spirit* to obess on such things.

In the end, you could take BS's approach and make FORTRAN+1 or ADD1TOCOBOL and it would end up violating those languages. He'd have some stupid obession about COMMON blocks in FORTRAN, maybe.

The funny thing is, the early parts of C++ really are improvements to (ANSI) C. It's the bizarre attempts to cover up a fundamentally procedural idiom that gets him into deep shit.
-drl
New Re: why bother?
Because you don't "own" and may not know the innards of the function you use and the const is part of a compiler enforced interface spec that leads to more predictable code behavior.

When all the code is yours, it does not matter so much. Unless, like me, you may forget what you've done in a couple of weeks.
Alex

"No man's life, liberty, or property are safe while the legislature is in session."\t-- Mark Twain
New Well, yes, that was what BS was obsessing on
..but why not just make an API with use instructions? If you use it wrong, you will get burned.

CAUTION: Don't use the space heater in a room filled with natural gas.

CAUTION: Remain clear of the blast zone.

CAUTION: Failure to deploy flaps in a timely manner will result in a stall and a fiery metallic death on landing.

CAUTION: Consuming ten times the recommended dosage of this medicine may produce symptoms such as breathlessness, little or no heartbeat, and lack of motivation.


You can't prevent people from being stupid. You have to give them the freedom to be smart.
-drl
New Clearly BS hates programmers and doesn't trust them
as far as he can throw them. Why else would he work so hard to wrap everything in a straight jacket? Java is kind of that way too but more moderate.

The only thing C++ ought to be used for is purposes for which it was designed. If you're not writing a telephone switching operating system, you don't need it.



I think that it's extraordinarily important that we in computer science keep fun in computing. When it started out, it was an awful lot of fun. Of course, the paying customer got shafted every now and then, and after a while we began to take their complaints seriously. We began to feel as if we really were responsible for the successful, error-free perfect use of these machines. I don't think we are. I think we're responsible for stretching them, setting them off in new directions, and keeping fun in the house. I hope the field of computer science never loses its sense of fun. Above all, I hope we don't become missionaries. Don't feel as if you're Bible salesmen. The world has too many of those already. What you know about computing other people will learn. Don't feel as if the key to successful computing is only in your hands. What's in your hands, I think and hope, is intelligence: the ability to see the machine as more than when you were first led up to it, that you can make it more.

--Alan Perlis
Expand Edited by tuberculosis Aug. 21, 2007, 06:25:33 AM EDT
New Re: Because it's not supposed to be modified...
ChrisR: i'd suspect that it's also not kosher to dereference a Const pointer.

Huh? A pointer you can't dereference isn't much of a pointer, is it.

There's no problem dereferencing a constant pointer. In fact, arrays in C are (in a certain sense) nothing more than a constant pointer.

ChrisR: If a dereference is allowed then the program can backdoor a method to change the value by casting it to another type and then doing an assign.

Isn't that the whole point of casting in C? :-)
--
-- Jim Weirich jweirich@one.net [link|http://w3.one.net/~jweirich|http://w3.one.net/~jweirich]
---------------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)
     I *heart* C++ - (admin) - (30)
         GNU compilers both sides? - (marlowe)
         What is the type of m_server_address? - (Arkadiy) - (3)
             As noted: - (admin) - (2)
                 Re: As noted: - (deSitter) - (1)
                     It isn't. - (admin)
         Fix: - (admin) - (24)
             const is a design error - (tuberculosis) - (23)
                 One of my directives for this port: - (admin) - (8)
                     Re: One of my directives for this port: - (deSitter) - (7)
                         The "const" attribute means that, within the given scope,... - (a6l6e6x) - (6)
                             Because it's not supposed to be modified... - (ChrisR) - (5)
                                 Yes, I remember all that.. - (deSitter) - (3)
                                     Re: why bother? - (a6l6e6x) - (2)
                                         Well, yes, that was what BS was obsessing on - (deSitter) - (1)
                                             Clearly BS hates programmers and doesn't trust them - (tuberculosis)
                                 Re: Because it's not supposed to be modified... - (JimWeirich)
                 Re: const is a design error - (JimWeirich) - (13)
                     Only if such differences exist - (tuberculosis) - (12)
                         Fun in computing. - (static)
                         Re: Only if such differences exist - (JimWeirich) - (10)
                             const functions - (tuberculosis) - (9)
                                 Well, it doesnt' appear to be overloaded on const - (Simon_Jester) - (8)
                                     Re: Well, it doesnt' appear to be overloaded on const - (JimWeirich)
                                     No, thats exactly the problem - (tuberculosis) - (6)
                                         This is what bugs me in Scott's problem... - (Arkadiy) - (5)
                                             I was pissed enough at the problem - (Arkadiy) - (4)
                                                 I was pissed enough that I: - (admin) - (3)
                                                     Solution - (Arkadiy) - (2)
                                                         ROFL - (admin)
                                                         Re: "..you can make it swallow the code." Beautiful! -NT - (a6l6e6x)

Now that's what I call self-defecating humor.
239 ms