Earlier quoted context omitted.
1) This made me curious. Are any of the compilers in real use nondeterministic? 2) Probably that's not needed? A normal optimizing compiler just inlines the function somewhere new — and boom? Then again, can that really happen with practical contemporary compilers and this exact statement?
Most compilers are nondeterministic in small ways. For example, it's common to use hash tables that are keyed by pointer address and then iterate over the entries in storage order, so the order in which certain things are emitted will change from run to run. This is why "deterministic builds" are such a big deal, and not just an obvious thing that you get for free. I don't know what the chances are that such a thing…
So you think you know C? (2016)
341–344 of 344 posts
Re: So you think you know C? (2016)
#342Earlier quoted context omitted.
Which only works if the sequences align perfectly. Handling misaligned collections is more awkward with functional constructs. Functional graph programming is also still a bit of an open problem. There are awkward scenarios in both cases.
Ah, I see what you mean. Yeah, that’s always awkward Not sure how you deal with that with for loops either. Increment the iteration var in the body of the loop? (Seems scary to me, but like I said, I’ve got terrible intuition with them)
var ie1 = foo.GetEnumerator();
var ie2 = bar.GetEnumerator();
while(true)
{
var has1 = ie1.MoveNext();
var has2 = ie2.MoveNext();
if (!has1 && !has2)
break;
if (has1)
// do something with ie1.Current
if (has2)
// do something with ie2.Current
}Re: So you think you know C? (2016)
#343Earlier quoted context omitted.
I'm well aware of what undefined behavior is. I still know it's undefined behavior and can read my compiler manual to answer the question of how the code behaves. "I don't know" is simply wrong.
> and can read my compiler manual to answer the question of how the code behaves. Which is both not true (because the compiler manual usually won't define undefined behaviour) and irrelevant (because the questions were about C, not about a compiler).
You're being pedantic about something silly, but you're also wrong in your pedantry.
Re: So you think you know C? (2016)
#344Having written a conforming C compiler, at one point I knew everything there was to know about C (I forget details now and then, or confusing them with C++ and D). But knowing every engineering detail is not the same thing as knowing how to program in C effectively. It's like being the engineer who designs a Grand Prix car. It does not mean you can drive it faster around the track than anyone else. Not even close. Fo…
after taking the test, wouldn't this be:
at one point I knew everything there was to know about (my implementation of) C
also: one time long ago I tried to use the c-preprocessor to preprocess a data file. ha ha ha ha ha. (conclusion: don't do that)