![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
> You have no way of knowing how much stack space you have. Nobody writing
> reliable code wants to recurse for each level of a tree without knowing
> how deep the tree is.
Nobody writes recursive code? IN WHICH UNIVERSE??
I'm also loving the way you say "you don't know how big the stack is",
and immediately follow that with "you should check how deep the tree
is". But if you don't know how big the stack is, you STILL don't know if
you can do it. :-P
Besides, it's not like there's an /alternative/ to recursion.
>> Nobody designs hardware like that any more. Haven't done for decades. :-P
>
> So? They're still special areas of memory built into the CPU. Just
> because you can't address them using normal addressing modes any more
> doesn't mean they're not memory.
Well, to be /technical/ about it, the entire concept of "memory" is a
fiction. It would be more accurate to say that there is a large topology
of transistors connected together - but that's not a very useful way to
think about it.
>> So you're telling me that the de facto calling convention that all
>> software
>> always uses is "undefined"?
>
> Implementation-specific, yes. How could you define it in a standard when
> you don't even know what architecture you're compiling for?
Amazing. So the one calling convention that every piece of software
supports isn't actually defined at all. That's impressive, right there.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
> At least on machines designed to be programmed in assembler, one can
> generally put a useful and informative comment on pretty much every line.
I haven't yet seen an assembler where you /can't/ stick comments
anywhere you want to. That /still/ doesn't mean I want the comments to
out-number the actual code.
>> You'd expect part of the language's basic syntax to be, you know...
>> part of
>> the language's basic syntax. But it isn't. It's just a regular operator,
>> which means you can use it in places where you shouldn't be putting
>> random
>> commas, and that makes it do strange stuff. (And, being C, this isn't
>> checked in any way.)
>
> Why would you put randomg *anything* in? This isn't a sonnet. It's
> computer code. Why would you put random commas in any more than you put
> random quote marks in?
Ever heard of something called a "mistake"? Perhaps you don't make
those, but I do sometimes. And it's worrying to know that if I do, the
compiler isn't going to say "oh, you made a mistake", it's just going to
generate code that does something bizarre.
> Plus, "void" is a relatively recent development.
This is The Real WTF.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On 4/21/2012 11:30, Orchid Win7 v1 wrote:
>> At least on machines designed to be programmed in assembler, one can
>> generally put a useful and informative comment on pretty much every line.
>
> I haven't yet seen an assembler where you /can't/ stick comments anywhere
> you want to. That /still/ doesn't mean I want the comments to out-number the
> actual code.
I said "useful."
> Ever heard of something called a "mistake"? Perhaps you don't make those,
> but I do sometimes. And it's worrying to know that if I do, the compiler
> isn't going to say "oh, you made a mistake", it's just going to generate
> code that does something bizarre.
Sure. And if you randomly change * to / and + to -, you'll get similar
errors. In practice, it's not a mistake people make.
--
Darren New, San Diego CA, USA (PST)
"Oh no! We're out of code juice!"
"Don't panic. There's beans and filters
in the cabinet."
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On 4/21/2012 11:28, Orchid Win7 v1 wrote:
>> You have no way of knowing how much stack space you have. Nobody writing
>> reliable code wants to recurse for each level of a tree without knowing
>> how deep the tree is.
>
> Nobody writes recursive code? IN WHICH UNIVERSE??
I have written very very little recursive code in my entire career. Of that,
90% of my recursive code is of the form
Try to X, 10 times.
if X failed,
Try to X one fewer times
Yes, my current project has a tree structure that's at most 3 levels deep,
and parsing that into flat structures is recursive, once. Before that, it
was iterative over a queue. (Actually, it might still be, I don't remember.)
> I'm also loving the way you say "you don't know how big the stack is", and
> immediately follow that with "you should check how deep the tree is". But if
> you don't know how big the stack is, you STILL don't know if you can do it. :-P
Well, I know the stack is deep enough to hold 3 levels of tree. The point is
you can't take an *arbitrary* tree and parse it recursively.
> Besides, it's not like there's an /alternative/ to recursion.
Of course there is. I'm pretty sure every recursive algorithm can be made
explicitly iterative. The advantage of doing so is that you can handle
failures of running out of resources, before you ask.
>>> Nobody designs hardware like that any more. Haven't done for decades. :-P
>>
>> So? They're still special areas of memory built into the CPU. Just
>> because you can't address them using normal addressing modes any more
>> doesn't mean they're not memory.
>
> Well, to be /technical/ about it, the entire concept of "memory" is a
> fiction. It would be more accurate to say that there is a large topology of
> transistors connected together - but that's not a very useful way to think
> about it.
But in some cases, those transistors are wired together in a way that
retains state arbitrarily long, which we call memory. ;-)
>>> So you're telling me that the de facto calling convention that all
>>> software
>>> always uses is "undefined"?
>>
>> Implementation-specific, yes. How could you define it in a standard when
>> you don't even know what architecture you're compiling for?
>
> Amazing. So the one calling convention that every piece of software supports
> isn't actually defined at all. That's impressive, right there.
Which calling convention do you think every piece of software supports? It's
defined by the implementation. Have you tried invoking Java code from C?
Have you tried invoking C# code from C++? Have you invoked C++ objects from
Haskell?
http://www.scribd.com/doc/20689745/Calling-Conventions
Not sure if you're trying to be sarcastic, incredulous, or simply ignorant here.
--
Darren New, San Diego CA, USA (PST)
"Oh no! We're out of code juice!"
"Don't panic. There's beans and filters
in the cabinet."
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Invisible
Subject: Re: Teach yourself C++ in 21 strange malfunctions
Date: 23 Apr 2012 03:58:16
Message: <4f950b98@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>> I think it's probably vacuous to try to estimate how "useful" it would be
>> without actually trying it...
>
> Well, they tried making STM work on .NET and gave up because of all the
> state, if you remember.
They gave up because they tried to make all the existing state mutation
stuff still work in the presence of transactions, which is /obviously/
impossible.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>> Ever heard of something called a "mistake"? Perhaps you don't make those,
>> but I do sometimes. And it's worrying to know that if I do, the compiler
>> isn't going to say "oh, you made a mistake", it's just going to generate
>> code that does something bizarre.
>
> Sure. And if you randomly change * to / and + to -, you'll get similar
> errors. In practice, it's not a mistake people make.
If you're in the middle of writing an expression, and the phone rings or
something, and then you got back and hit "compile", it says "hey dude,
this * operator only has one argument. Shouldn't there be two?"
But, apparently, if you're half way through writing a function call and
the same thing happens, the compiler doesn't say anything, because comma
is just a valid operator that you can put anywhere you want...
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>> Nobody writes recursive code? IN WHICH UNIVERSE??
>
> I have written very very little recursive code in my entire career.
Damn... I'm trying to think of something you can code without actually
using recursion. Hmm. Well, I guess there must be /something/...
>> Besides, it's not like there's an /alternative/ to recursion.
>
> Of course there is. I'm pretty sure every recursive algorithm can be
> made explicitly iterative. The advantage of doing so is that you can
> handle failures of running out of resources, before you ask.
So if you want to count how many nodes there are in a binary tree, how
do you do that non-recursively?
>> Amazing. So the one calling convention that every piece of software
>> supports
>> isn't actually defined at all. That's impressive, right there.
>
> Which calling convention do you think every piece of software supports?
> Not sure if you're trying to be sarcastic, incredulous, or simply
> ignorant here.
If a programming language supports calling /any/ foreign language, that
language will always be C. It will know about standard C types, it will
usually know about C structs, and it will let you call arbitrary C
functions.
And yet, the way that you call a C function is, apparently, undefined.
That's pretty bizarre.
It also makes me wonder how the heck it's possible to take object code
from multiple C compilers and link it all together, if each of them is
potentially using a completely different calling convention. It sounds
like it shouldn't work.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Francois Labreque
Subject: Re: Teach yourself C++ in 21 strange malfunctions
Date: 23 Apr 2012 08:28:14
Message: <4f954ade$1@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>> Not to mention a lot cheaper than a dozen
>> occupational therapy sessions due to tendinitis or carpal tunnel
>> syndrome.
>
> Nobody gets tendinitis just from using a mouse.
>
I have two weeks off work, 10 physiotherapy sessions and a visit from an
occupational therapist at home to redesign my work space that disagree
with you.
When you need to use the mouse with your right hand, you need to lift
your arm over the numeric keypad and off to the side to grab the mouse,
then move the arm back to the keyboard so that your can continue typing.
In most cases, this means lifting your entire arm from the shoulder on
down, whereas if you were using your mouse left-handed, you'd only need
to move your wrist, with your elbow still resting on the chair's arm rest.
Repeated sporadic use of the mouse over the course of two long mights
and days of work did cause me to have tendinitis bad enough that I had
to be driven to the hospital since I could no longer lift my right arm
at the shoulder, and it would have been too dangerous to try to drive in
those conditions.
--
/*Francois Labreque*/#local a=x+y;#local b=x+a;#local c=a+b;#macro P(F//
/* flabreque */L)polygon{5,F,F+z,L+z,L,F pigment{rgb 9}}#end union
/* @ */{P(0,a)P(a,b)P(b,c)P(2*a,2*b)P(2*b,b+c)P(b+c,<2,3>)
/* gmail.com */}camera{orthographic location<6,1.25,-6>look_at a }
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>> Nobody gets tendinitis just from using a mouse.
>
> I have two weeks off work, 10 physiotherapy sessions and a visit from an
> occupational therapist at home to redesign my work space that disagree
> with you.
OK. So maybe you had the desk at the wrong height or something? IDK.
I've been using a mouse since I was 12, sometimes staying up to program
until 2 in the morning, and it hasn't caused my any trouble.
FWIW, I also play keyboard, where you have to constantly support the
entire weight of your arm all the time. And I played violin for years...
> When you need to use the mouse with your right hand, you need to lift
> your arm over the numeric keypad and off to the side to grab the mouse,
> then move the arm back to the keyboard so that your can continue typing.
> In most cases, this means lifting your entire arm from the shoulder on
> down, whereas if you were using your mouse left-handed, you'd only need
> to move your wrist, with your elbow still resting on the chair's arm rest.
I usually have an arm rest set up so I only have to lift my forearm, not
my entire arm, but hey.
> Repeated sporadic use of the mouse over the course of two long mights
> and days of work did cause me to have tendinitis bad enough that I had
> to be driven to the hospital since I could no longer lift my right arm
> at the shoulder, and it would have been too dangerous to try to drive in
> those conditions.
Damn. And to think that I have to lift 14 stone of my dance partner...
That said, my shoulder *does* hurt now! >_<
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Francois Labreque
Subject: Re: Teach yourself C++ in 21 strange malfunctions
Date: 23 Apr 2012 19:47:47
Message: <4f95ea23$1@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>>> Nobody gets tendinitis just from using a mouse.
>>
>> I have two weeks off work, 10 physiotherapy sessions and a visit from an
>> occupational therapist at home to redesign my work space that disagree
>> with you.
>
> OK. So maybe you had the desk at the wrong height or something? IDK.
> I've been using a mouse since I was 12, sometimes staying up to program
> until 2 in the morning, and it hasn't caused my any trouble.
It wasn't a problem for me either until I had to do it 40 hours straight...
>
> FWIW, I also play keyboard, where you have to constantly support the
> entire weight of your arm all the time. And I played violin for years...
>
That's probably it, your shoulder muscles are trained.
>> When you need to use the mouse with your right hand, you need to lift
>> your arm over the numeric keypad and off to the side to grab the mouse,
>> then move the arm back to the keyboard so that your can continue typing.
>> In most cases, this means lifting your entire arm from the shoulder on
>> down, whereas if you were using your mouse left-handed, you'd only need
>> to move your wrist, with your elbow still resting on the chair's arm
>> rest.
>
> I usually have an arm rest set up so I only have to lift my forearm, not
> my entire arm, but hey.
>
>> Repeated sporadic use of the mouse over the course of two long mights
>> and days of work did cause me to have tendinitis bad enough that I had
>> to be driven to the hospital since I could no longer lift my right arm
>> at the shoulder, and it would have been too dangerous to try to drive in
>> those conditions.
>
> Damn. And to think that I have to lift 14 stone of my dance partner...
>
> That said, my shoulder *does* hurt now! >_<
Not for 40 hrs straight...;)
--
/*Francois Labreque*/#local a=x+y;#local b=x+a;#local c=a+b;#macro P(F//
/* flabreque */L)polygon{5,F,F+z,L+z,L,F pigment{rgb 9}}#end union
/* @ */{P(0,a)P(a,b)P(b,c)P(2*a,2*b)P(2*b,b+c)P(b+c,<2,3>)
/* gmail.com */}camera{orthographic location<6,1.25,-6>look_at a }
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |