General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Manuell
David Bombal
comments
Comments by "Manuell" (@manuell3505) on "" video.
@StefaNoneD A compiler doesn't run the program. All the allocated bits that represent a variable can be assigned independently, without using a identifier. The compiler cannot know that. But you can "forbid" the usage of bytewise mutations or things like sprintf(), and mandate a code-analysis tool to find missing "official" assignment statements. This is the behaviour of any C-compiler. Variables are actually only human support. They are all pointers to memory adresses that exist without having names anyway.
2
Isn't that still the case? If you declare a int without assigning a value to it, the compiler will break if it's later used in a e.g. conditional comparison. No big deal in C, though. A single unset value taking it down is easy to trace back. But I once had this in a huge bash script...
1
@StefaNoneD Not? I still do that. A function can have both parameters and local variables. They have to be declared with known types. Except from direct program space manipulation, there's no other way in C. You can forget to assign a value to a variable but that goes for any language/compiler. Best habit for C is to strictly zero everything at declaration. Unless you're working with a tiny computer, that won't have any noticeable performance impact.
1