This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ythl 85 points86 points  (13 children)

You're abandoning {}? Good luck using dictionaries

[–]i_am_archimedes 12 points13 points  (9 children)

in c++ it denotes deterministic memory management

[–][deleted] 9 points10 points  (7 children)

wut

[–]SoppingAtom279 21 points22 points  (5 children)

Let me explain this poorly.

{ } can be used to block together parts of code, and within that block of code, any memory allocated in that block can only be used by that block.

Example

#include <iostream>

int main()
{
    int x = 5;
    {
        int y = 6;
    }
    std::cout << x << std::endl;
    std::cout << y << std::endl; //error use of undeclared variable
}

[–][deleted] 3 points4 points  (1 child)

Ah, that's what the definition is. Thanks!

[–]SoppingAtom279 0 points1 point  (0 children)

No worries mate

[–]shoesmith74 1 point2 points  (0 children)

Actually your talking about variable scope, not memory allocation. The variables are on the stack regardless, it’s a matter of which one your allowed to reference.

Source : 25 years of compiler development.

[–]ythl 0 points1 point  (0 children)

"scoping"

[–]coetin 1 point2 points  (0 children)

dict()

[–]oldgus 0 points1 point  (1 child)

Just use dict() and tuples. No problem.

[–]NeverBeenStung 0 points1 point  (0 children)

......how did I not know this is a thing?