lostsoul said:
but haven't found any problems jet with additionaly using the pragma:
no warnings 'uninitialized';
Perhaps I am being a bit too old fashioned and conservative here; but If I saw that in a code review, I'd issue an immediate "Reject -- Unsafe Coding Practice; Not Allowed In Production" defect and terminate the review right then and there.
The 'initialized variable' warning is an indicator to me that the Coder either: a) doesn't understand the logic because He (and almost all ways it's a male) couldn't figure out what the proper starting value should be, or b) is too lazy to add the three or four more characters needed to ensure that the subsequent code has a sound starting place. Turning any warning off is an immediate red-flag.
This is another example of "Just because you CAN do something doesn't mean that you SHOULD do it." In the forty plus years I have been playing at this Game, I have been bitten by the initialized-variable problem far too often; I can't think of one occasion when I couldn't define the proper starting conditions for my variables.
Note: I started my career on machines that did not 'zero-core' before loading a new program. If you didn't initialize your variables, they started with what ever bit-trash was lying in the patch of memory they were assigned. I spent the entire summer in my Junior year debugging a C compiler that Bell Labs had "ported" to the S/360 (an IBM mainframe Operating System), because of the tacit assumption that all numerical variables (either init, float, or double) would contain x'00' as their initial value. I come by my bias honestly. And yes, I finally ran down all of the for loops (both the explicit ones and all the implicit loops); but it took three long months of debugging some 'really clever code' in a language that I had only just been exposed to. ("Hey, weren't you read K&R just last month? Here is the problem we have and you're just the lad to sort it out.")
----
I Go Back to Sleep, Now.
OGB
|