Click here to Skip to main content
15,886,919 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: All in - pointer declaration Pin
k505412-Dec-22 5:54
mvek505412-Dec-22 5:54 
GeneralRe: All in - pointer declaration Pin
den2k8812-Dec-22 20:40
professionalden2k8812-Dec-22 20:40 
GeneralRe: All in - pointer declaration Pin
0x01AA12-Dec-22 6:05
mve0x01AA12-Dec-22 6:05 
GeneralRe: All in - pointer declaration Pin
Mircea Neacsu12-Dec-22 6:21
Mircea Neacsu12-Dec-22 6:21 
GeneralRe: All in - pointer declaration Pin
trønderen12-Dec-22 6:48
trønderen12-Dec-22 6:48 
GeneralRe: All in - pointer declaration Pin
Mircea Neacsu12-Dec-22 6:51
Mircea Neacsu12-Dec-22 6:51 
GeneralRe: All in - pointer declaration Pin
honey the codewitch12-Dec-22 8:41
mvahoney the codewitch12-Dec-22 8:41 
GeneralRe: All in - pointer declaration Pin
trønderen12-Dec-22 11:40
trønderen12-Dec-22 11:40 
Most programmers of *nix/C upbringing insist that #define constants are named in UPPER_CASE so that you can easily see from the name that it is a constant. Strangely enough, the majority of that very same group detests Hungarian blurb, even though the argument for the blurb is very much the same. Why isn't the conclusion identical? Well, the answer is not invented here ...

I dislike both strongly. They seem fine for release 1.0. Then, as we experienced in one project, several of those static configuration parameters, #defines, were in release 2.0 made dynamically configurable, runtime modifiable. In those days we didn't have an IDE that could automatically rename a symbol throughout the project; it had to be done manually in every single file, and there were quite a few of them; it took some effort. So for quite some time, we had a number of all-uppercase variables. We experienced "Constants ain't. Variables won't." long before it became a standard rule.

That project made me ask myself: Why really did I have to know at all times whether that value is constant or variable? Did it really affect my use of it? Should it? Constant-ness is sort of a "nice to know", but when it turns into a "need to know", you should stop and ask yourself: Do I really need to know?

We had a very similar experience when porting code from 16 bits Windows 95 to 32 bits Windows XP, in the days when everyone spoke Hungarian. Lots of variable were expanded in size, and the renaming of them put on the todo list.

Again, I asked myself (and my coworkers): Is it really significant, as seen from a problem solution point of view, whether this counter is 16 or 32 bits? Isn't it quite obvious that this other value is a string, both from is (blurbless) name and its use? Especially when moving code between different architectures, any blurb reflecting implementation (such as word length) is meaningless. For any semantics based blurb, you really don't gain much until you include, say, the struct type name in extenso - it obviously is a struct; you don't need a blurb for that!

I have learned to program very much with disregard to the type definition; I don't have to look it up to see if it is a short, an int, a long or a longlong - it is large enough for its use. The float has sufficient precision for its use. If you are in doubt whether a value is a count (some sort of integer) or a measurement (some sort of float), then you should spend some time on understanding the solution at a conceptual level, not at the implementation type level!

And boy, do I miss working with languages providing a decent type system! Not even in C# is there a proper 'enum' definition - yes, there is something called enum, which is just a thin veil over integers. 50+ years old Pascal had proper enums. Proper subranges. Going on to 40+ years old CHILL, where you could define distinct, say, integer types, so that you didn't inadvertently add AppleCount to ClassSize. Some languages allowed types associating a unit (or more precisely: A set of units) with values of that type; I only read about those, but sure would like to have it available.

Stated briefly: The type system is a grossly neglected area in almost all languages born after the breakthrough of C.
GeneralRe: All in - pointer declaration Pin
den2k8812-Dec-22 20:42
professionalden2k8812-Dec-22 20:42 
GeneralRe: All in - pointer declaration Pin
Rage12-Dec-22 21:13
professionalRage12-Dec-22 21:13 
GeneralRe: All in - pointer declaration Pin
den2k8812-Dec-22 21:36
professionalden2k8812-Dec-22 21:36 
GeneralRe: All in - pointer declaration Pin
Rage13-Dec-22 1:17
professionalRage13-Dec-22 1:17 
GeneralRe: All in - pointer declaration Pin
den2k8813-Dec-22 2:07
professionalden2k8813-Dec-22 2:07 
GeneralRe: All in - pointer declaration Pin
honey the codewitch12-Dec-22 14:21
mvahoney the codewitch12-Dec-22 14:21 
GeneralRe: All in - pointer declaration Pin
Mircea Neacsu12-Dec-22 14:28
Mircea Neacsu12-Dec-22 14:28 
GeneralRe: All in - pointer declaration Pin
jschell12-Dec-22 10:44
jschell12-Dec-22 10:44 
GeneralRe: All in - pointer declaration Pin
trønderen12-Dec-22 12:03
trønderen12-Dec-22 12:03 
GeneralRe: All in - pointer declaration Pin
jschell13-Dec-22 10:27
jschell13-Dec-22 10:27 
GeneralRe: All in - pointer declaration Pin
Gary R. Wheeler12-Dec-22 12:44
Gary R. Wheeler12-Dec-22 12:44 
GeneralRe: All in - pointer declaration Pin
Greg Utas12-Dec-22 13:17
professionalGreg Utas12-Dec-22 13:17 
GeneralRe: All in - pointer declaration Pin
Gary R. Wheeler12-Dec-22 14:24
Gary R. Wheeler12-Dec-22 14:24 
GeneralRe: All in - pointer declaration Pin
Greg Utas13-Dec-22 3:10
professionalGreg Utas13-Dec-22 3:10 
GeneralRe: All in - pointer declaration Pin
jmaida12-Dec-22 16:01
jmaida12-Dec-22 16:01 
GeneralRe: All in - pointer declaration Pin
den2k8812-Dec-22 20:36
professionalden2k8812-Dec-22 20:36 
GeneralI'll see your curly braces & raise you a variable naming convention Pin
raddevus12-Dec-22 4:28
mvaraddevus12-Dec-22 4:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.