Any c++ experts here? I have a few questions:
If I know the maximum size of a loop does it benefit me to make my loop variable I a short rather than an int? If I am consistent with such tweaks throughout my code - will I see smaller, faster code?
Additionally - I have N threads who work exclusively with HEX in the format 0x000-0xFFF, if I were to create a simple string ((threads * length) + 1) long and provide pointers to their respective positions in the string, could the threads safely use the string as a storage object without requiring mutexes etc? Is this a bad idea?
Thanks /g/!
Yes but is pretty negligible. Also you drastically affect the reusability of your code.
>>60287637
>not making it auto
not gonna make it
Also that's a corgo not a doggo
Using shorts instead of ints will save RAM, but it may or may not be faster on your CPU. That depends on the CPU you're using. Download your CPU's Software Optimization Guides and look it up there.
>>60287637
Depends on architecture famalamalia
>>60287637
compile with optimizations on, profile it, look at the disassembly
Sounds bad, if nothing else it's easy to make errors. Why not have them edit separate strings, and then concat when you need the whole string for something?
>>60287637
it literally does not, a 64 bit machine uses 64 bit registers and will, in most cases, still waste 64 bits storing a variable thats less than 64 bit