General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Lepi Doptera
Core Dumped
comments
Comments by "Lepi Doptera" (@lepidoptera9337) on "The size of your variables matters." video.
Usually, but that's not where you are losing the big bucks on modern CPUs. Your real problem are cache misses. Where your variable is in memory is far more important than what it is.
2
That is correct, however, if your web browser allocates two gigabytes of memory for every web page the user opens, then most people will stop using your web browser after approx. five minutes.
1
It's only being stored in your source code and then implicitly in the instruction flow of the compiled program. There is nothing in a compiled C program that will tell you explicitly what type of variable resides where and what its original name was. You can, if you want, include debug information in your program, then those tables will be included, together with the real names of your functions. But why make it easy for hackers to decompile your code, right?
1
It doesn't. The compiler makes sure that whatever instruction flow accesses that memory location only uses float32 instructions to process it UNLESS you specify otherwise. There is nothing to stop you from pointing at your float's location with an int pointer and then the real fun begins. You can even give the same memory location multiple names and types with a union.
1