A Conversation for The H2G2 Programmers' Corner
can someone help an absolute beginner in c++?
26199 Posted May 20, 2003
Installing on Linux does take practice... with any luck it will become less frustrating after a while, and simply be annoyingly time-consuming
can someone help an absolute beginner in c++?
MaW Posted May 20, 2003
On Gentoo, most things are a breeze... yes you have to wait for them to compile, but you don't have to sit there watching it all the time.
Minor topic drift
Potholer Posted May 20, 2003
I was wondering what people's opinions were on the ? operator.
As a side-effect of some recent unexpected work for an interactive testing company, it transpires that ANSI C regards the value of the ? operator as a definite lvalue, whereas C++ (ANSI C++, I think) considers the result to be an lvalue if the two colon-seperated parts have similar type. Apparently, the GNU C compiler follows the C++ model by default, allowing
( a ? a : b ) = c ;
as an equivalent to
if (a) a=c; else b=c;
while ANSI C would barf on the same code.
On an unrelated and vaguely ironically humorous issue, I recently got a book from the local library which was an introduction to network and information security. In the section about the different ways that unauthorised people can access information (social engineering, dumpster diving, etc), I found a piece of paper with the notes which a previous reader had made, and which they had forgotten to remove from the book before returning it to the library. No passwords, unfortunately.
Minor topic drift
MaW Posted May 21, 2003
Hmm, that makes sense... C++ has a much stricter typing system than C, so that kind of thing is compileable, as the compiler can check if it's okay at compile time, rather than allowing it to crash spectacularly at runtime.
Minor topic drift
Potholer Posted May 21, 2003
Whoops - just spotted a typo in my post. It should have been that ANSI C considers the value of a whole ? expression as a definite *rvalue*.
I can see some vague utility in allowing
(a ? b : c) = d ;
for reasons of compactness of source code, especially where d is a large expression, but it wouldn't be hard to make an optimising compiler realise that
if (a)
b = (some long and complicated expression) ;
else
c = (same long and complicated expression) ;
could be optimised to be the same as the equivalent conditional expression.
Reading around yesterday, I found that where lvalue-returning conditional expressions are allowed in C/C++ compilers, there is some variation about the meaning of
a ? b : c = d ;
some treat it as
a ? b : (c = d) ;
and some as
(a ? b : c) = d ;
at least the less elegant:
*(a ? &b : &c) = d ;
makes it clearer that something odd is happening, and works consistently across all C and C++ compilers.
Hidden
Potholer Posted May 22, 2003
Hidden posting? I hope I didn't start some kind of Holy War here...
can someone help an absolute beginner in c++?
Fazed up Posted May 22, 2003
Love the sound affects!!!!
can someone help an absolute beginner in c++?
Calculator Nerd 256 Posted May 26, 2003
no there was no hidden posting. my "friend" aaron waited for me to log on and then overpowered me out of the chair, said some bad stuff, and then REPORTED it. I hope they don't kick me off
>8^B
can someone help an absolute beginner in c++?
Calculator Nerd 256 Posted May 26, 2003
oh and as a response to about a page ago, i am using RH 8
didn't have time to read anything, i was too busy freaking out over the dirty things aaron wrote. i do hope the moderators cover up that stuff at my space
>8^B
can someone help an absolute beginner in c++?
Calculator Nerd 256 Posted May 26, 2003
i never use the ? operator or the switch() function. i am not familiar with the syntax and more comfortable with an ugly line of for()s and if()s
what sound effects?
>8^B
can someone help an absolute beginner in c++?
MaW Posted May 26, 2003
Technically, switch isn't a function... it's a statement.
can someone help an absolute beginner in c++?
Calculator Nerd 256 Posted May 26, 2003
good for you, maybe i can go to college some day. i was really relying on getting into OSSM for high school, though. the one i am in the district for isn't very prestigious if u know what i mean
>8^B
Key: Complain about this post
can someone help an absolute beginner in c++?
- 61: 26199 (May 20, 2003)
- 62: MaW (May 20, 2003)
- 63: Potholer (May 20, 2003)
- 64: MaW (May 21, 2003)
- 65: Potholer (May 21, 2003)
- 66: Calculator Nerd 256 (May 21, 2003)
- 67: MaW (May 21, 2003)
- 68: Potholer (May 22, 2003)
- 69: Fazed up (May 22, 2003)
- 70: Calculator Nerd 256 (May 26, 2003)
- 71: Calculator Nerd 256 (May 26, 2003)
- 72: Calculator Nerd 256 (May 26, 2003)
- 73: MaW (May 26, 2003)
- 74: Calculator Nerd 256 (May 26, 2003)
- 75: Calculator Nerd 256 (May 26, 2003)
- 76: MaW (May 26, 2003)
- 77: Calculator Nerd 256 (May 26, 2003)
- 78: Calculator Nerd 256 (May 27, 2003)
More Conversations for The H2G2 Programmers' Corner
Write an Entry
"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."