Conversation started Aug 1, 2013 at 4:49.
Aug 1, 2013 04:49
@Mysticial
Would someone show me where in the C standard it is mentioned that an implementation must use a "stack"?
@EiyrioüvonKauyf :)
Why can't a graph be used, instead? Wouldn't a graph be more suitable, given the atomic operations defined in the new standard?
yes a graph would be perfectly reasonable for a computer
because graphs are how the world works and are perfectly simple structures
show me a quantum computer too
@Borgleader I'm not entirely sure how they do it. We know that all the destructors from child all the way up to the base class need to be called in that order.
Aug 1, 2013 04:51
Stackoverflow is forever...
and that's not how atomic operations work
they're either done via kernel locking or hardware
that IS in the standard
You can either call them from the v-table one-by-one, or create separate versions that "include" the destructors of all the base classes above it.
"The implementation makes use of processor-specific instructions where possible (via inline assembler, platform libraries or compiler intrinsics), and falls back to "emulating" atomic operations through locking.
" copied from the boost library
i can reference the standard next if you like
That saves v-table indirections at the cost of more code.
@MarkGarcia dammit we need to do the think we do on @BoltCrank or whatever
Aug 1, 2013 04:53
@Mysticial So you're saying MSVC's approach favors speed where gcc's favors code size?
@EiyrioüvonKauyf Does that mean a stack is required, according to the standard?
@Borgleader Maybe? It's hard to guess their intentions.
Have you had a look at tail call optimisation, yet?
@Mysticial Alright, I was just curious because the robot didn't know either when we discussed it yesterday
@undefinedbehaviour show me a turing machine that using a graph
@undefinedbehaviour the same look you "had"
Aug 1, 2013 04:54
I might make an SO question out of it, once I've done a proper analysis
@EiyrioüvonKauyf Is it impossible? Yes, or no.
@undefinedbehaviour you don't discuss impossible in theoretical cs. by that reason so are computers. they're impossible
@Borgleader But yeah, either the child's destructor calls the parent's destructor -> chaining it all the way up to the top. Or you inline it completely.
@EiyrioüvonKauyf Answer the question.
@undefinedbehaviour define your graph
undirected, directed and with cycles or not
Aug 1, 2013 04:56
@EiyrioüvonKauyf Which part of the C standard permits optimisations?
in a complete graph you can have a turing machine, it's a crappy version of a stack
@EiyrioüvonKauyf Define your recursion.
A stack isn't required by the C or C++ standard.
Then again a lot of things aren't so it's an irrelevant point.
@EiyrioüvonKauyf Consider that some edges might correspond to atomic locks.
@undefinedbehaviour this is not at all related to your comment on performance
and redefining a stack as a crappy graph doesn't make you right
Aug 1, 2013 04:58
@EiyrioüvonKauyf Neither is the stack, nor "recursion vs iteration"...
@undefinedbehaviour do you want to speak english?
@EiyrioüvonKauyf What is relevant to performance in regards to C, is one specific section of the standard. Which section is that?
If you can't quote it, I think this chatroom should laugh you off of the planet.
@undefinedbehaviour . what are you even.yes the standard explicitly defines performance no call shall take more then 3 nanoseconds
@undefinedbehaviour What's relevant to performance in C or any other language? The fact that people actually care about how fast their program performs in real-life?
I think I've made my point. @EiyrioüvonKauyf doesn't even know which optimisations are permitted in a valid C implementation.
@EiyrioüvonKauyf Consider what might happen if the function call is optimised away.
Aug 1, 2013 05:01
.
i'm not even going to bother
also btw you like the standard
> The semantic descriptions in this International Standard describe the behavior of an
> abstract machine in which issues of optimization are irrelevant.
How can you justify your comments regarding "a stack" which might be entirely optimised away, too.
§5.1.2.3p6.
Read that. It's 5 points below what you just quoted.
genius
scroll above
i never said it had to be a stack. i said emulate a turing machine and you can run it
Once you've read that, discriminate between "abstract machine" and "actual implementation".
Aug 1, 2013 05:03
show me anything about optimization that uses your "actual implementation" in the standard
Alternatively, an implementation might perform various optimizations within each translation unit, such
that the actual semantics would agree with the abstract semantics only when making function calls across
translation unit boundaries. In such an implementation, at the time of each function entry and function
return where the calling function and the called function are in different translation units, the values of all
externally linked objects and of all objects accessible via pointers therein would agree with the abstract
What, you mean tail call recursion? Dead code elimination?
you can turn those off you know with this thing called options and tail call recursion isn't always the best idea
You can, but it's not worth mentioning speed if you're not going to mention optimisations.
The entire 1000 page C++ standard has 10 mentions of the word optimization.
Interesting.
@undefinedbehaviour Depends on how you define things. It requires a last-in, first-out structure to support (for one example) recursive calls. From an abstract viewpoint, LIFO and stack are basically synonymous. OTOH, the restrictions it places on that LIFO structure are quite minimal, and certainly don't require a stack supported by a stack pointer register, "push" and "pop" instructions, or anything on that order.
Aug 1, 2013 05:05
... likewise, it's not worth profiling if you're not going to enable optimisations.
@JerryCoffin Yes, but that's assuming the program in question actually has unoptimisable recursive calls.
@undefinedbehaviour no it is. you just said tail call recursion yourself you can manually implement good and bad tail call recursion. remember how we said COMPILERS
"no it is" what, my subliterate, little friend?
Are you smarter than your compiler? I highly doubt that.
oh that's funny
11 Recursive function calls shall be permitted, both directly and indirectly through any chain
of other functions.
and @undefinedbehaviour yes you can be
look at the difference between GCC and MSVC
they are GENERAL
for certain programs you can write better compilers
That doesn't mean they're required in a translated program. Consider int main(void) { }. Where is the stack?
for example memory allocation
GCC does crappy allocation
it wastes SHIT loads of memory
but it's really fast
you can write a better compiler
Aug 1, 2013 05:09
... and it does tail call optimisation...
yes
memory allocation does tail call recursion
obviously
So your discussion discriminating "recursive fibonacci" from "iterative fibonacci" is irrelevant, if the recursion is tail recursive and the compiler is gcc.
. yes that's obviously what i mean when i talk about how one compiler can optimize
... in fact, presuming the program produces the same output every time, your compiler might even optimise the function calls away, producing an O(1) program that merely prints the static output.
How is your algorithms class, now, my subliterate, little friend?
no
"motivation: people using gnu c as a portable assembler suffer from the
fact that there is no way to make gcc do proper tail recursion. as a
result, some scheme compilers (bigloo, stalin and hobbit, which is
used by guile) are not standard compliant (scheme requires proper tail
recursion) and at least one prolog compiler (gnu prolog) has switched
from generating c code to assembler, making it non-portable (it is
currently only avaible for x86 and sparc). the prolog-like mercury
has to jump through some (non-portable) hoops to use gcc as an
where is your compiler now my literate friend
no one says shit is done
and you can overflow tail call recursion
static code analysis isn't god
Aug 1, 2013 05:14
If you're trying to prove that converting code using recursion to code using loops is impossible, then you should probably ask them that...
come on try doing tail call recursion in python without obfuscating code in case of stack throwups
you're so clever right
@EiyrioüvonKauyf Congratulations, you found some 13 year old claim that GCC does not TCO.
Now can you please stop escalating this?
guido likes nice tracebacks because stack frames
@R.MartinhoFernandes i got confused what the point of this was wayyyy back
Aug 1, 2013 05:16
(Namely, I'm not too happy with the "subliterate" shit being thrown around.)
technically i never said subliterate
@EiyrioüvonKauyf Sorry, I mean plural "you". English is terrible.
the only insult i did was dumbass :| but i got called subliterate quite a bit
I'm fine with you discussing this, but please keep it civil.
You didn't call me stupid?
Aug 1, 2013 05:17
where
show me your citation
Oh, neat. You deleted it. "are you stupid? No standard on the planet "defines speed". Have you even taken an algorithms course?"
sorry i don't see it
it's not in the standard
Alright, both of you cool it.
@Mysticial technically it's C :P so Gordan can't get mad about that
@R.MartinhoFernandes To be honest I was going to just bin all of it but I was watching a movie
Aug 1, 2013 05:19
@Rapptz you should bin all of it
@R. I suggest that you consider that EiyrioüvonKauyf might be a troll.
hahaha
mhmm i collect my bridge taxes with a side of my gold
Question the constructiveness of anything it has to say, and decide where to go from there.
mhmm it
what could it be
I can take my own conclusions, thank you.
Aug 1, 2013 05:20
I'm off to do more important things. Have a nice day, and learn how to cite relevant parts of the C standard :)
If these messages aren't binned, I'll be sure to bookmark them. :)
@R.MartinhoFernandes I have no doubt.
1 min ago, by undefined behaviour
I'm off to do more important things. Have a nice day, and learn how to cite relevant parts of the C standard :)
..... AHAHAHHHAHAH right
@Rapptz that was eventful :3
One of the worst discussions of the night.
^
@DeadMG would be crying
and binning left and right
it was lacking in pedanticism. i'm sorry; i failed you master :|
Aug 1, 2013 05:25
@Rapptz I guess I should count myself lucky I didn't even care to look at it.
@R.MartinhoFernandes you are. it was bs-ery
@R.MartinhoFernandes Yeah I didn't either but it was pretty moronic.
._. i'm happy cat wasn't around
or i would have gotten shit tossed
 
Conversation ended Aug 1, 2013 at 5:26.