C++ is love
-
I needed some garbage-collector like advantages without the overhead so I wrote a 123 line file to give me exactly that. I love C++, and right now I don't know why I ever messed with .NET. :thumbsup::thumbsup::thumbsup: I'm usually not one to holy roll about technology but this language absolutely rules. The only downside with it is it hides nothing (and it doesn't parse properly**), but hiding nothing is just as big an advantage as a liability. Oh how I missed you, C++. ** C++ should really be parsed with a GLR parser so you don't have to worry about incomplete types being a thing.
Real programmers use butterflies
-
I needed some garbage-collector like advantages without the overhead so I wrote a 123 line file to give me exactly that. I love C++, and right now I don't know why I ever messed with .NET. :thumbsup::thumbsup::thumbsup: I'm usually not one to holy roll about technology but this language absolutely rules. The only downside with it is it hides nothing (and it doesn't parse properly**), but hiding nothing is just as big an advantage as a liability. Oh how I missed you, C++. ** C++ should really be parsed with a GLR parser so you don't have to worry about incomplete types being a thing.
Real programmers use butterflies
Back in the days of yore, when I did my C programming, I discovered alloca(). Used inside of functions, instead of malloc() (for example), it would free allocated memory when you left the function. I didn't look into the workings but I'd presume it used the stack for memory. Update: Quick Search [^] and it's in C++, too - and it does use the stack for allocatons.
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein
"If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010
-
I needed some garbage-collector like advantages without the overhead so I wrote a 123 line file to give me exactly that. I love C++, and right now I don't know why I ever messed with .NET. :thumbsup::thumbsup::thumbsup: I'm usually not one to holy roll about technology but this language absolutely rules. The only downside with it is it hides nothing (and it doesn't parse properly**), but hiding nothing is just as big an advantage as a liability. Oh how I missed you, C++. ** C++ should really be parsed with a GLR parser so you don't have to worry about incomplete types being a thing.
Real programmers use butterflies
-
Back in the days of yore, when I did my C programming, I discovered alloca(). Used inside of functions, instead of malloc() (for example), it would free allocated memory when you left the function. I didn't look into the workings but I'd presume it used the stack for memory. Update: Quick Search [^] and it's in C++, too - and it does use the stack for allocatons.
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein
"If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010
W∴ Balboos, GHB wrote:
I'd presume it used the stack for memory.
Yep, exactly. I had the habit of making objects "stackable" whenever possible, for example strings had fixed size straight into the struct, so the whole object was a single contiguous dataspace easily allocatable in the stack and passed around with a memcpy. Of course it isn't alwasy the best option but I like it when it is.
GCS d--(d+) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
-
W∴ Balboos, GHB wrote:
I'd presume it used the stack for memory.
Yep, exactly. I had the habit of making objects "stackable" whenever possible, for example strings had fixed size straight into the struct, so the whole object was a single contiguous dataspace easily allocatable in the stack and passed around with a memcpy. Of course it isn't alwasy the best option but I like it when it is.
GCS d--(d+) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
Some of the references warn against its use. So far as I can tell, it's based upon usage and gotcha's that are common in C - in other words, C is for grownup who take responsibility for their actions. Simply put - know what you're doing when you do it. Don't free() it - well, duh! That's the point of using it. Beware of stack overflows. Always keep your wits about you with memory usage. Don't use in recursive functions or loops. In a loop, index the allocations into an array of pointers, or, if you want to reuse the same one, allocate it before the loop . . . just like the other memory functions. Seems standard enough - for the grownups in the room
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein
"If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010
-
I needed some garbage-collector like advantages without the overhead so I wrote a 123 line file to give me exactly that. I love C++, and right now I don't know why I ever messed with .NET. :thumbsup::thumbsup::thumbsup: I'm usually not one to holy roll about technology but this language absolutely rules. The only downside with it is it hides nothing (and it doesn't parse properly**), but hiding nothing is just as big an advantage as a liability. Oh how I missed you, C++. ** C++ should really be parsed with a GLR parser so you don't have to worry about incomplete types being a thing.
Real programmers use butterflies
honey the codewitch wrote:
I needed some garbage-collector like advantages
Now all you need to do is add heap compacting[^] and maybe heap compression[^]. :-D
-
I needed some garbage-collector like advantages without the overhead so I wrote a 123 line file to give me exactly that. I love C++, and right now I don't know why I ever messed with .NET. :thumbsup::thumbsup::thumbsup: I'm usually not one to holy roll about technology but this language absolutely rules. The only downside with it is it hides nothing (and it doesn't parse properly**), but hiding nothing is just as big an advantage as a liability. Oh how I missed you, C++. ** C++ should really be parsed with a GLR parser so you don't have to worry about incomplete types being a thing.
Real programmers use butterflies
Blasphemy! Quick, fall on your knees and repent, or you will see hordes with torches and pitchforks gathering. While the .Net guys are not as fanatically religious as Holy Order of the Javaites, they could still burn you like their steaks at a stake (*). (*) FTMS - fixed that myself.
I have lived with several Zen masters - all of them were cats. His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
-
I needed some garbage-collector like advantages without the overhead so I wrote a 123 line file to give me exactly that. I love C++, and right now I don't know why I ever messed with .NET. :thumbsup::thumbsup::thumbsup: I'm usually not one to holy roll about technology but this language absolutely rules. The only downside with it is it hides nothing (and it doesn't parse properly**), but hiding nothing is just as big an advantage as a liability. Oh how I missed you, C++. ** C++ should really be parsed with a GLR parser so you don't have to worry about incomplete types being a thing.
Real programmers use butterflies
Sounds like you're in regression. Next year you'll be hot for C and after that you'll start a club with Codewraith doing 1802 assembler for your own Zwölf.
Wrong is evil and must be defeated. - Jeff Ello Never stop dreaming - Freddie Kruger
-
I needed some garbage-collector like advantages without the overhead so I wrote a 123 line file to give me exactly that. I love C++, and right now I don't know why I ever messed with .NET. :thumbsup::thumbsup::thumbsup: I'm usually not one to holy roll about technology but this language absolutely rules. The only downside with it is it hides nothing (and it doesn't parse properly**), but hiding nothing is just as big an advantage as a liability. Oh how I missed you, C++. ** C++ should really be parsed with a GLR parser so you don't have to worry about incomplete types being a thing.
Real programmers use butterflies
Ok, now give it a name that references literature, something like "Quixote Garbage Collector". Then make a slogan that's inspired by LOTR, maybe "I am Gandalf the White and I've come to collect your garbage" or "There is no curse in Elvish, Entish, or the tongues of Men for this garbage collector." Now live out your life as Facebook, Google, Microsoft or Apple buys you out for quintagazillions$$$ and share some with me :D (For those who miss the joke, read post below)
Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript
-
Sounds like you're in regression. Next year you'll be hot for C and after that you'll start a club with Codewraith doing 1802 assembler for your own Zwölf.
Wrong is evil and must be defeated. - Jeff Ello Never stop dreaming - Freddie Kruger
Or you could run in circles, like poor Sander. He hasn't noticed yet because he's still on his first lap. :-)
I have lived with several Zen masters - all of them were cats. His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
-
Ok, now give it a name that references literature, something like "Quixote Garbage Collector". Then make a slogan that's inspired by LOTR, maybe "I am Gandalf the White and I've come to collect your garbage" or "There is no curse in Elvish, Entish, or the tongues of Men for this garbage collector." Now live out your life as Facebook, Google, Microsoft or Apple buys you out for quintagazillions$$$ and share some with me :D (For those who miss the joke, read post below)
Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript
It doesn't really do garbage collection as such. As an analogy imagine the garbage man came once a week and burned your house down. It's much more time and space efficient than taking out the trash. You can't actually delete objects in my scheme, only allocate to pools. You can recycle entire pools though, manually, freeing (invalidating) all pointers (or objects) therein. Doing it that way makes it fast fast fast and it works on constrained memory environments. Also it was easy to code.
Real programmers use butterflies
-
Some of the references warn against its use. So far as I can tell, it's based upon usage and gotcha's that are common in C - in other words, C is for grownup who take responsibility for their actions. Simply put - know what you're doing when you do it. Don't free() it - well, duh! That's the point of using it. Beware of stack overflows. Always keep your wits about you with memory usage. Don't use in recursive functions or loops. In a loop, index the allocations into an array of pointers, or, if you want to reuse the same one, allocate it before the loop . . . just like the other memory functions. Seems standard enough - for the grownups in the room
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein
"If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010
Yeah which is why i don't use it. I have
StaticMemoryPool<C>
which can allocate a fixed amount of data from the heap or the stack (capacity C known at compile time) andDynamicMemoryPool
which allocates a capacity specified at runtime, but always from the heap. using dynamic stack allocations is messy because its intertwined with scope. Plus it goes out of scope with the function ends making wrapping it not a thing. Maybe that's why it's warned against. *shrug* I really don't know.Real programmers use butterflies
-
How much can you sell it for? And/or can you get 1 million (or more) devs to use it? That's our modern (cynical) measure for success so get on board. :rolleyes:
I gave it away under the MIT license. It was just a little bit of code anyway.
Real programmers use butterflies
-
honey the codewitch wrote:
I needed some garbage-collector like advantages
Now all you need to do is add heap compacting[^] and maybe heap compression[^]. :-D
Then that would be an actual garbage collector, which I'm trying to avoid. :-D Actually what I'm doing is kind of clever. I allow you to allocate a "MemoryPool" on the heap or the stack, and then allocate memory from that pool. It does not allow you to delete. However, all allocated segments are always contiguous and sequential, leading to a number of performance advantages. Instead of deleting single allocations you can freeAll() to reset/recycle the entire pool and invalidate the memory therein. It's actually quite nice for a lot of basic processing scenarios. it's just inefficient for mutable data where sizes can change - which it's not designed for.
Real programmers use butterflies
-
Ok, now give it a name that references literature, something like "Quixote Garbage Collector". Then make a slogan that's inspired by LOTR, maybe "I am Gandalf the White and I've come to collect your garbage" or "There is no curse in Elvish, Entish, or the tongues of Men for this garbage collector." Now live out your life as Facebook, Google, Microsoft or Apple buys you out for quintagazillions$$$ and share some with me :D (For those who miss the joke, read post below)
Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript
You don't simply collect Garbage in Mordor! :-)
I have lived with several Zen masters - all of them were cats. His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
-
Yeah which is why i don't use it. I have
StaticMemoryPool<C>
which can allocate a fixed amount of data from the heap or the stack (capacity C known at compile time) andDynamicMemoryPool
which allocates a capacity specified at runtime, but always from the heap. using dynamic stack allocations is messy because its intertwined with scope. Plus it goes out of scope with the function ends making wrapping it not a thing. Maybe that's why it's warned against. *shrug* I really don't know.Real programmers use butterflies
It's only scope, certainly how I used it, was within the function - scope was never a problem. Memory wasn't humongous, then, so allocations were done with care, anyway. There was expanded and extended memory.* It's built in (usually) and automatic. About the only complaint I found really valid is that it's existence in a compiler is not (or was not) guaranteed as it was an official standard. It happened to be everywhere I was (QuickC, MS-C, Wacom-C) on DOS and NT, manly; Now I live in a stateless world of web development. I will say, however, that with the 400 users, an occasional server request gets an out-of-memory error. I increased it in php.ini a couple of times, but for the most part, the DBA and I share info and he forces filters them to not ask for a million records. A better long-term solution. *I made a page-swapper so I could access lots of it smoothly beyond the 64K in the original page frame.
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein
"If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010
-
You don't simply collect Garbage in Mordor! :-)
I have lived with several Zen masters - all of them were cats. His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
Garbage shall not pass.
Wrong is evil and must be defeated. - Jeff Ello Never stop dreaming - Freddie Kruger
-
Garbage shall not pass.
Wrong is evil and must be defeated. - Jeff Ello Never stop dreaming - Freddie Kruger
I reserve that one for some unit test. "YOU ! Shall! Not! Pass!" :-)
I have lived with several Zen masters - all of them were cats. His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
-
How much can you sell it for? And/or can you get 1 million (or more) devs to use it? That's our modern (cynical) measure for success so get on board. :rolleyes:
raddevus wrote:
How much can you sell it for?
That's capitalism, and htcw does not believe in that. :)
-
I needed some garbage-collector like advantages without the overhead so I wrote a 123 line file to give me exactly that. I love C++, and right now I don't know why I ever messed with .NET. :thumbsup::thumbsup::thumbsup: I'm usually not one to holy roll about technology but this language absolutely rules. The only downside with it is it hides nothing (and it doesn't parse properly**), but hiding nothing is just as big an advantage as a liability. Oh how I missed you, C++. ** C++ should really be parsed with a GLR parser so you don't have to worry about incomplete types being a thing.
Real programmers use butterflies
Sure, C++ is love, but at what price does this "love" cost? your soul, I am sure. We are talking about C++ here. :laugh: