Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Quick Compiler Question

Name: Anonymous 2010-02-27 9:06

So I was thinking about C programs a short while ago, and a problem occurred to me.

Let's say that I have a function in which, say, we define a variable. It might look something like this:

int dicks (int cocks)
{
    int wangs;
    /* Do stuff to wangs and cocks here */
    return wangs;
}


Looking at int wangs; it seems that the compiler translates that line into "allocate space for an integer and return a pointer to it." If this is a case, is the compiler setting aside space for a new integer every time I run the function, or does it optimize by assuming that I'm only going to have one instance of it and just set aside space for a single int?

Whatever the answer to that previous question is, how would the compiler handle a recursive function? How would


Never mind, I'm an idiot. I forgot about registers and the stack for a second. I revoke my previous questions.

NEW QUESTION: What is the point of tail-call optimization? If all it does is convert recursive functions into iterative ones, why not just program them that way in the first place?

Name: Anonymous 2010-02-27 10:00

>>6
[code]
// ==UserScript==
// @name          EXPERT BBCODE FRAMEWORK
// @namespace     http://userscripts.org/GetEnterpriseContent.jsp?EID=983298183&cd=china&page=EnterpriseRenderer1
// @description   Advanced Shiichan BBCode Previewer Integration Suite.
// @include       http://dis.4chan.org/read/*
// ==/UserScript==


// EXPECT THESE FEATURES IN NEXT VERSIONS:
// - Improved scalability (working on all textareas, not only in threads).



////////////////////////////////////////////////////////////////////////////////////
//////
//////
//////   )   ___      ___   __     __)  _____     _____     _       _____) _____  
//////  (__/_____)  /(,  ) (, /|  /|   (, /   )  (, /   ___/__)   /       (, /   )
//////    /        /    /    / | / |    _/__ /     /   (, /       )__       /__ / 
//////   /        /    /  ) /  |/  |_   /      ___/__    /      /        ) /   \_ 
//////  (______) (___ /  (_/   '     ) /     (__ /      (_____ (_____)  (_/       
//////                              (_/                        )                  
//////
////// 
//////



/

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List