DEV Community

Discussion on: Swap two numbers without using a temporary variable

 
wclayferguson profile image
Clay Ferguson

My first 10 years of work was C++, so I know a thing or two about stacks and heaps. haha, and I did agree with everything you were saying.

Thread Thread
 
amplanetwork profile image
Ampla Network

I know we were agree from the begining ha ha, I started coding professionally almost 20 years ago with c++ / c# and JS at the same time (My brain must be a little damaged lol), I hope we master a bit heap, stacks and memory allocation even in managed languages loool.

But it is good to remember how optimization works, and always keep in mind that the way we write code does impact heavily the way it will run.

I remember when I learned in c++ to use a 1 dimensional array as it was a 2 one for performance reason, and then understood that in JS an Array ... is not an Array... but an object with numerical key as properties... No comment... Ha ha ha ha (Until you use a real array like a TypedArray for sure). Definition of fun BTW...

Thread Thread
 
amplanetwork profile image
Ampla Network

Did I really wrote "We were agree", sorry for that, I will return to school to re learn grammar :-)

Thread Thread
 
wclayferguson profile image
Clay Ferguson

We probably have a similar belief on most things, sounds like. I branched off to Java in 1998, and never touched C#. I never forgave Bill Gates for trying to "hijack" Java with his Windows proprietary version of the language, and not until recently and because of VSCode and TypeScript did I personally find forgiveness for MSFT.