D - enum
- Sean L. Palmer (13/13) Jun 08 2002 It doesn't seem that I can access enum members without qualifying them.
- Walter (4/17) Jun 08 2002 You won't need to qualify them if you make them anonymous enums, like:
- Matthew Wilson (6/31) Jun 08 2002 Yuch!
- Sean L. Palmer (11/45) Jun 08 2002 We don't want ADA-style mandates, do we? If there's a conflict, sure, b...
- Matthew Wilson (29/78) Jun 08 2002 Sure. I'm not advocating that we end up with Java's ridiculously low
- Pavel Minayev (12/21) Jun 10 2002 them
- Matthew Wilson (5/27) Jun 10 2002 And a very good thing too. Now if we can wean all the terse programmers ...
- Robert W. Cunningham (72/75) Jun 10 2002 Reminds me of my own torrid programming past. As a deeply-embedded C
- Matthew Wilson (67/142) Jun 10 2002 Bob
- Walter (1/1) Jun 10 2002 This is a great post! Thanks. -Walter
- Roberto Mariottini (9/15) Jun 11 2002 have
- Matthew Wilson (8/25) Jun 11 2002 Roberto
-
Robert W. Cunningham
(26/57)
Jun 11 2002
- Walter (12/16) Jun 13 2002 And
- OddesE (24/40) Jun 26 2002 group.
- Matthew Wilson (9/53) Jun 26 2002 Agreed. This place is a positive relief from the rough and tumble of oth...
- OddesE (50/125) Jun 26 2002 away
-
Walter
(5/12)
Jun 08 2002
How would you qualify an unnamed enum
? - Sean L. Palmer (5/19) Jun 08 2002 What I want is an anonymous enum with a name, evidently. ;)
- Pavel Minayev (6/7) Jun 10 2002 Just make an alias:
- Sean L. Palmer (17/24) Jun 10 2002 It just seems kludgy; It's the behavior I'd want from enums to begin wi...
- Walter (8/21) Jun 10 2002 with.
- Sean L. Palmer (4/22) Jun 11 2002 completely rewritten:
- Russ Lewis (8/33) Jun 11 2002 It defines the underlying type of the enum, rather than letting the
- Walter (4/8) Jun 13 2002 Yes. If you think about it as being like selecting a "base class", the
- Sean L. Palmer (4/12) Jun 14 2002 Yes, sounds cool.
It doesn't seem that I can access enum members without qualifying them. enum colors { red=0, green=1, blue=2 }; int whichcolor = red; // error unknown identifier int whichcolor = colors.red; // ok This is causing grief when porting direct3d apps which expect their enum members to be globally accessible. I'd change them to const int etc but they really are an enum and I'd lose typechecking capability. I suppose I could write it like so: typedef uint D3DRENDERSTATETYPE; const D3DRENDERSTATETYPE D3DRS_ALPHABLENDENABLE = 196; //etc But I'd rather that enum just worked as expected. Sean
Jun 08 2002
You won't need to qualify them if you make them anonymous enums, like: enum { red, green, blue } "Sean L. Palmer" <seanpalmer earthlink.net> wrote in message news:adtnqu$16j2$1 digitaldaemon.com...It doesn't seem that I can access enum members without qualifying them. enum colors { red=0, green=1, blue=2 }; int whichcolor = red; // error unknown identifier int whichcolor = colors.red; // ok This is causing grief when porting direct3d apps which expect their enum members to be globally accessible. I'd change them to const int etc but they really are an enum and I'd lose typechecking capability. I suppose I could write it like so: typedef uint D3DRENDERSTATETYPE; const D3DRENDERSTATETYPE D3DRS_ALPHABLENDENABLE = 196; //etc But I'd rather that enum just worked as expected. Sean
Jun 08 2002
Yuch! Surely it is better to enforce the qualification. Maintenance costs far exceed original authoring, so who cares about a little effort now? "Walter" <walter digitalmars.com> wrote in message news:adtsm9$1b4s$1 digitaldaemon.com...You won't need to qualify them if you make them anonymous enums, like: enum { red, green, blue } "Sean L. Palmer" <seanpalmer earthlink.net> wrote in message news:adtnqu$16j2$1 digitaldaemon.com...IIt doesn't seem that I can access enum members without qualifying them. enum colors { red=0, green=1, blue=2 }; int whichcolor = red; // error unknown identifier int whichcolor = colors.red; // ok This is causing grief when porting direct3d apps which expect their enum members to be globally accessible. I'd change them to const int etc but they really are an enum and I'd lose typechecking capability. I supposecould write it like so: typedef uint D3DRENDERSTATETYPE; const D3DRENDERSTATETYPE D3DRS_ALPHABLENDENABLE = 196; file://etc But I'd rather that enum just worked as expected. Sean
Jun 08 2002
We don't want ADA-style mandates, do we? If there's a conflict, sure, but if no conflict why inflict such pain on the programmer? If you strictly compartmentalize everything and enforce scope qualifications for everything, D would end up being a quite wordy language. Sean "Matthew Wilson" <dmd synesis.com.au> wrote in message news:adu2pt$1gtv$2 digitaldaemon.com...Yuch! Surely it is better to enforce the qualification. Maintenance costs far exceed original authoring, so who cares about a little effort now? "Walter" <walter digitalmars.com> wrote in message news:adtsm9$1b4s$1 digitaldaemon.com...them.You won't need to qualify them if you make them anonymous enums, like: enum { red, green, blue } "Sean L. Palmer" <seanpalmer earthlink.net> wrote in message news:adtnqu$16j2$1 digitaldaemon.com...It doesn't seem that I can access enum members without qualifyingenumenum colors { red=0, green=1, blue=2 }; int whichcolor = red; // error unknown identifier int whichcolor = colors.red; // ok This is causing grief when porting direct3d apps which expect theirbutmembers to be globally accessible. I'd change them to const int etcsupposethey really are an enum and I'd lose typechecking capability. IIcould write it like so: typedef uint D3DRENDERSTATETYPE; const D3DRENDERSTATETYPE D3DRS_ALPHABLENDENABLE = 196; file://etc But I'd rather that enum just worked as expected. Sean
Jun 08 2002
Sure. I'm not advocating that we end up with Java's ridiculously low functionality : SLOCs ratio, but there are certain issues that seem pretty cut and dried (I'm just putting up my umbrella in anticipation of you all raining down scorn upon me) such as: 1. Mandatory braces. Almost all experienced programmers end up putting them in everywhere, so let's just admit that the odd bit of typing now will save masses of effort later. IDE macros can easily be made to do this for us anyway, for those who dislike key-presses. 2. Conditional expressions must be boolean. Thus one must compare integrals against constant int i; ... if(i != 0) and pointers (sorry, I mean references, spot the C++ programmer!) must compare to null SomeObject o ... if(o != null) This is not going to affect generated code in anyway, but is (i) more immediately accessible to the reviewer/maintainer (not to mention the original author some months later), and (ii) less error-prone I believe there is a precedent for this kind of rigour (unless memory misserves) in Walter's requiring all enum members to be mentioned in switch statements (of enums) as a guard against addition to the enum without addition to the switch case list. (Can someone refresh my memory as to the exact nature of this post?) "Sean L. Palmer" <seanpalmer earthlink.net> wrote in message news:adu3ar$1he8$1 digitaldaemon.com...We don't want ADA-style mandates, do we? If there's a conflict, sure, but if no conflict why inflict such pain on the programmer? If you strictly compartmentalize everything and enforce scope qualifications for everything, D would end up being a quite wordylanguage.Sean "Matthew Wilson" <dmd synesis.com.au> wrote in message news:adu2pt$1gtv$2 digitaldaemon.com...Yuch! Surely it is better to enforce the qualification. Maintenance costs far exceed original authoring, so who cares about a little effort now? "Walter" <walter digitalmars.com> wrote in message news:adtsm9$1b4s$1 digitaldaemon.com...them.You won't need to qualify them if you make them anonymous enums, like: enum { red, green, blue } "Sean L. Palmer" <seanpalmer earthlink.net> wrote in message news:adtnqu$16j2$1 digitaldaemon.com...It doesn't seem that I can access enum members without qualifyingenumenum colors { red=0, green=1, blue=2 }; int whichcolor = red; // error unknown identifier int whichcolor = colors.red; // ok This is causing grief when porting direct3d apps which expect theirbutmembers to be globally accessible. I'd change them to const int etcsupposethey really are an enum and I'd lose typechecking capability. IIcould write it like so: typedef uint D3DRENDERSTATETYPE; const D3DRENDERSTATETYPE D3DRS_ALPHABLENDENABLE = 196; file://etc But I'd rather that enum just worked as expected. Sean
Jun 08 2002
"Matthew Wilson" <dmd synesis.com.au> wrote in message news:adu4u3$1j4h$1 digitaldaemon.com...1. Mandatory braces. Almost all experienced programmers end up puttingthemin everywhere, so let's just admit that the odd bit of typing now willsavemasses of effort later. IDE macros can easily be made to do this for us anyway, for those who dislike key-presses.For more flame on this topic, you might want to post this into the thread started earlier for the same reason. =)2. Conditional expressions must be boolean. Thus one must compareintegralsagainst constant This is not going to affect generated code in anyway, but is (i) more immediately accessible to the reviewer/maintainer (not to mention the original author some months later), and (ii) less error-proneYou know, I myself find this feature quite convenient, both when I write programs and when I read others code. Clearly, !a is the same as (a != 0). One thing that caused problem was when you wrote "if (a = 1)", but it is forbidden in D now.
Jun 10 2002
And a very good thing too. Now if we can wean all the terse programmers away from all their other write-once unmaintain-ever-more practises, we should really be cooking "Pavel Minayev" <evilone omen.ru> wrote in message news:ae34ps$leg$1 digitaldaemon.com..."Matthew Wilson" <dmd synesis.com.au> wrote in message news:adu4u3$1j4h$1 digitaldaemon.com...1. Mandatory braces. Almost all experienced programmers end up puttingthemin everywhere, so let's just admit that the odd bit of typing now willsavemasses of effort later. IDE macros can easily be made to do this for us anyway, for those who dislike key-presses.For more flame on this topic, you might want to post this into the thread started earlier for the same reason. =)2. Conditional expressions must be boolean. Thus one must compareintegralsagainst constant This is not going to affect generated code in anyway, but is (i) more immediately accessible to the reviewer/maintainer (not to mention the original author some months later), and (ii) less error-proneYou know, I myself find this feature quite convenient, both when I write programs and when I read others code. Clearly, !a is the same as (a != 0). One thing that caused problem was when you wrote "if (a = 1)", but it is forbidden in D now.
Jun 10 2002
Matthew Wilson wrote:And a very good thing too. Now if we can wean all the terse programmers away from all their other write-once unmaintain-ever-more practises, we should really be cookingReminds me of my own torrid programming past. As a deeply-embedded C programmer for 20 years now, one who was brought up on assembler, I still have this craven need to write monstrously complex functions in two or three lines of impenetrable obfuscated C. The goal is to do the most with the fewest keystrokes, yet make the fastest possible code. My peers hated it. My bosses hated it. When I became independent, my clients hated it. But you see, sometimes I just had to do it. I couldn't resist. I want to push C down to the level of finely honed assembly macros (which can get positively Forth-like if left to their own devices). And if the rest of the world couldn't understand it, well, it just proved they didn't really know C all that well. Right? To make everyone shut up, I started putting the "correct" code in there as well, then I'd use the preprocessor to switch between the two instances. I could show the two were functionally equivalent (and on some occasions they even produced the same code). Well, compilers got smarter, the style battles got harder to fight, and programmers got dumber (in a good way ;^). Simple straightforward code is what everyone wanted, and I finally caved. Now I use braces and semicolons and parentheses everywhere they can legally go. I no longer pay attention to operator precedence: Parens make that a non-issue in all but a very few cases. I no longer ever have "if" and "else" on the same line, and always have full brace sets between them. I no longer define structs and enums in-place, even when they are throw-aways. I use layer upon layer of typedefs to avoid the magic of tangled Gordian C type declarations. My include files are huge and comprehensive. I use variable names with more than one letter, sometimes they may even be found in dictionaries (of some language). Then I started using variable naming conventions, so all my pointers start with p, and member data with m, and so on to the land of the noted Hungarian. Well, I did stop at that last one. Nipped it in the bud. I'm not that far gone. Not quite yet. But then it got worse: I started using "style guides" and "coding standards". Then I even started writing the damned things! Then my code started to go through the pretty-printer/reformatter without even a single change. (BTW, "astyle" rocks.) I even started thinking the blasted tools "rocked". I started using lint and "-Wall", and my compiles became warning-free. Pffft. Warnings are feared only by those who don't know what they mean. I had to enter so many more characters in my code that I actually had to stop looking at the keyboard while I typed. My comment-to-code ratio went from 1:10 to 2:1, and I even started using documentation generators (which would always gag on my old code). I had to go to ever-higher display resolutions on ever-larger displays to get enough code visible in a single window to hold a complete thought. My functions had only a single entry and exit and were goto-free, with each loop fully closed, each if else'd. Yes, I truly caved. But I still sneak in the occasional line or two of raw distilled power-code. I am a man, dammit! And I can still code my way out of a paper bag. But I do it with about 20 lines of surrounding comments. (It feels like wrapping a diamond in burlap.) My "safe" coding has had its cost: I no longer solve those PC-Lint puzzles in a single glance. Sometimes it takes two glances, taking a pause between them to adjust the reading glasses on my nose. I no longer "see" code in the empty editor window, like I did way back when, when the hardest problem was making my eyes keep up with my fingers on the keyboard. Now I actually have to do designs. And do eye exercises. But at least my typing has improved. It allows me to write long, wandering posts to newsgroups in the blink of an eye. I like D simply because it removes so much of the temptation to delve into obfuscation. The only problem is that I have to fire up a Windows system to use it. Did I mention I'm really good on the keyboard? I hate mice. I hate windowing systems that don't have keystrokes for doing everything. I hate MS Windows. I hate that D runs only under Windows. I hate that I have to take down my ultra-stable SMP Linux system, and reboot into Win98 (and give up a processor) to run D. But it is worth it, once in a while, if only so I can avoid the seductive siren call of minimalist C. Somebody shoot me. -BobC PS: D rocks!
Jun 10 2002
Bob If you were an attractive lady, and I not unattached to mine, I think I'd have to marry you! Almost completely agree with everything you say, particularly salient is your description of the maturation process from hero-geek to software engineer. I'm always bemused when people have not made that transition after many years in the game. Surely it's either that they've been working on the same product/project, for the same company, using the same technology. Like you, once reviewing and teaching became a large part of what I do, the use of all those neat tricks (that still appeal, as you say) becomes untenable. How can one say "you must do x" when one is still doing "!x". Down with hypocrisy, down with short-term solutions (minimal coding now for maximum maintenance in the future). One of the _few_ good things about Java is that the compiler enforces a few good things (missing / superfluous exception catches, boolean conditional statements, etc.) on the practise of its programmers. On thge subject of Hungarianism, always making conditional expressions boolean aids with reducing the amount of Hungarian. In addition, by forcing pointers/references to compare to null (rather than 0) also assists. Pretty much only use p and cch/cb (differentiation between count of characters and count of bytes is very important in Ansi/Unicode C/C++) these days. Matthew P.S. Agree D rocks, but there's a lot more stuff needed until it blasts the these languages, rather as an evolution of C++, but that's exactly what I see as its most important (from a political point of view) target). "Robert W. Cunningham" <rcunning acm.org> wrote in message news:3D056A53.CAC0C830 acm.org...Matthew Wilson wrote:awayAnd a very good thing too. Now if we can wean all the terse programmersshouldfrom all their other write-once unmaintain-ever-more practises, wehavereally be cookingReminds me of my own torrid programming past. As a deeply-embedded C programmer for 20 years now, one who was brought up on assembler, I stillthis craven need to write monstrously complex functions in two or threelinesof impenetrable obfuscated C. The goal is to do the most with the fewest keystrokes, yet make the fastest possible code. My peers hated it. My bosses hated it. When I became independent, myclientshated it. But you see, sometimes I just had to do it. I couldn't resist.Iwant to push C down to the level of finely honed assembly macros (whichcan getpositively Forth-like if left to their own devices). And if the rest oftheworld couldn't understand it, well, it just proved they didn't really knowCall that well. Right? To make everyone shut up, I started putting the "correct" code in there as well, then I'd use the preprocessor to switch between the two instances.Icould show the two were functionally equivalent (and on some occasionstheyeven produced the same code). Well, compilers got smarter, the style battles got harder to fight, and programmers got dumber (in a good way ;^). Simple straightforward code iswhateveryone wanted, and I finally caved. Now I use braces and semicolons and parentheses everywhere they can legally go. I no longer pay attention to operator precedence: Parens make that a non-issue in all but a very few cases. I no longer ever have "if" and "else" on the same line, and alwayshavefull brace sets between them. I no longer define structs and enums in-place, even when they arethrow-aways.I use layer upon layer of typedefs to avoid the magic of tangled Gordian Ctypedeclarations. My include files are huge and comprehensive. I usevariablenames with more than one letter, sometimes they may even be found in dictionaries (of some language). Then I started using variable naming conventions, so all my pointers start with p, and member data with m, andso onto the land of the noted Hungarian. Well, I did stop at that last one. Nipped it in the bud. I'm not thatfargone. Not quite yet. But then it got worse: I started using "style guides" and "codingstandards".Then I even started writing the damned things! Then my code started to go through the pretty-printer/reformatter without even a single change.(BTW,"astyle" rocks.) I even started thinking the blasted tools "rocked". I started using lint and "-Wall", and my compiles became warning-free.Pffft.Warnings are feared only by those who don't know what they mean. I had to enter so many more characters in my code that I actually had tostoplooking at the keyboard while I typed. My comment-to-code ratio went from1:10to 2:1, and I even started using documentation generators (which wouldalwaysgag on my old code). I had to go to ever-higher display resolutions on ever-larger displays to get enough code visible in a single window to holdacomplete thought. My functions had only a single entry and exit and were goto-free, witheachloop fully closed, each if else'd. Yes, I truly caved. But I still sneak in the occasional line or two of raw distilledpower-code. Iam a man, dammit! And I can still code my way out of a paper bag. But Ido itwith about 20 lines of surrounding comments. (It feels like wrapping adiamondin burlap.) My "safe" coding has had its cost: I no longer solve those PC-Lintpuzzles ina single glance. Sometimes it takes two glances, taking a pause betweenthemto adjust the reading glasses on my nose. I no longer "see" code in theemptyeditor window, like I did way back when, when the hardest problem wasmaking myeyes keep up with my fingers on the keyboard. Now I actually have to do designs. And do eye exercises. But at least my typing has improved. It allows me to write long,wanderingposts to newsgroups in the blink of an eye. I like D simply because it removes so much of the temptation to delve into obfuscation. The only problem is that I have to fire up a Windows systemtouse it. Did I mention I'm really good on the keyboard? I hate mice. I hatewindowingsystems that don't have keystrokes for doing everything. I hate MSWindows. Ihate that D runs only under Windows. I hate that I have to take down my ultra-stable SMP Linux system, and reboot into Win98 (and give up aprocessor)to run D. But it is worth it, once in a while, if only so I can avoid the seductivesirencall of minimalist C. Somebody shoot me. -BobC PS: D rocks!
Jun 10 2002
"Robert W. Cunningham" <rcunning acm.org> wrote in message news:3D056A53.CAC0C830 acm.org...Reminds me of my own torrid programming past. As a deeply-embedded C programmer for 20 years now, one who was brought up on assembler, I stillhavethis craven need to write monstrously complex functions in two or threelinesof impenetrable obfuscated C. The goal is to do the most with the fewest keystrokes, yet make the fastest possible code. [... big snip of an highly worth-to-read piece of text ...]I don't have enough skill in english to express how much I agree with you. I have only 14 years of programming and I don't make any embedded work, but my story is very similar to yours. I think your article should be published on the web for everyone to read. Ciao
Jun 11 2002
Roberto That's an excellent idea. Bob, do you fancy having that post as an opinion piece in the first issue of "The D Journal"? "Roberto Mariottini" <rmariottini lycosmail.com> wrote in message news:ae4mpp$27vo$1 digitaldaemon.com..."Robert W. Cunningham" <rcunning acm.org> wrote in message news:3D056A53.CAC0C830 acm.org...stillReminds me of my own torrid programming past. As a deeply-embedded C programmer for 20 years now, one who was brought up on assembler, Ihavefewestthis craven need to write monstrously complex functions in two or threelinesof impenetrable obfuscated C. The goal is to do the most with thekeystrokes, yet make the fastest possible code. [... big snip of an highly worth-to-read piece of text ...]I don't have enough skill in english to express how much I agree with you. I have only 14 years of programming and I don't make any embedded work, but my story is very similar to yours. I think your article should be published on the web for everyone to read. Ciao
Jun 11 2002
<blush!> Once in a while the muse strikes. But like the lightning, I can't control it. I really do wish I had paid attention during the two writing classes I had to endure to get my degree. They were the only English classes I had to take in five years of higher education. Sure, use the post however you like! But don't ask me to edit it: I'll kill it dead, since my normal writing style is third-person-distant. But please keep the headers with it: Context is important, and I hope it will encourage people to read the other fantastic threads that keep appearing in this newsgroup. As several others have noted before, this is one hell of a special group. And I'm delighted that it has kept its flavor and quality as the D crowd has grown. I doubt I'd have ever thought to toss my random thoughts into any other forum. That is, I probably wouldn't even have thought the thoughts I wrote. This place seems to make people think deeper and write better. Many members of this forum entered with sirens howling, strobes flashing, and guns blazing. Then, within a week or a month, each would calm down, listen, then start to contribute in a big way. Tolerance, understanding and persistence are rare things to be expressed so well, and so often. This place rocks. -BobC PS: What if we got the Israelis and Palestinians to sit down and learn D? We'd probably see the first peace treaty that compiled without error, ran without crashing, and was understood by everyone to be the correct solution to the problem. ;^) Matthew Wilson wrote:Roberto That's an excellent idea. Bob, do you fancy having that post as an opinion piece in the first issue of "The D Journal"? "Roberto Mariottini" <rmariottini lycosmail.com> wrote in message news:ae4mpp$27vo$1 digitaldaemon.com..."Robert W. Cunningham" <rcunning acm.org> wrote in message news:3D056A53.CAC0C830 acm.org...stillReminds me of my own torrid programming past. As a deeply-embedded C programmer for 20 years now, one who was brought up on assembler, Ihavefewestthis craven need to write monstrously complex functions in two or threelinesof impenetrable obfuscated C. The goal is to do the most with thekeystrokes, yet make the fastest possible code. [... big snip of an highly worth-to-read piece of text ...]I don't have enough skill in english to express how much I agree with you. I have only 14 years of programming and I don't make any embedded work, but my story is very similar to yours. I think your article should be published on the web for everyone to read. Ciao
Jun 11 2002
"Robert W. Cunningham" <rcunning acm.org> wrote in message news:3D06B965.445249E6 acm.org...As several others have noted before, this is one hell of a special group.AndI'm delighted that it has kept its flavor and quality as the D crowd has grown. I doubt I'd have ever thought to toss my random thoughts into anyotherforum. That is, I probably wouldn't even have thought the thoughts Iwrote. When this group was first set up, I thought it would need moderation (look at com.lang.* newsgroups for comparison). I've been delightfully pleased that it needs none at all. It's like my experience in the compiler business. I've never needed to deal with the problems that other mail order businesses seem to regularly experience. My conclusion is that the products I make simply attract a much higher quality of customer than the competitors do <g>.
Jun 13 2002
"Walter" <walter digitalmars.com> wrote in message news:aeb9ef$1c72$1 digitaldaemon.com..."Robert W. Cunningham" <rcunning acm.org> wrote in message news:3D06B965.445249E6 acm.org...group.As several others have noted before, this is one hell of a specialAndanyI'm delighted that it has kept its flavor and quality as the D crowd has grown. I doubt I'd have ever thought to toss my random thoughts intootherBut I do think an important part of this is that you are on your own server? I have not yet seen a single spamvertisement here, a great relief! Also, on this group there aren't so many people that flame you to death if you post off topic, if you didn't read the f*cking manual or if you simply disagree with them. I love it here and it is one of the only groups I ever go recently. Posting on or even reading comp.lang.c++ just doesn't seem worth it any more... :(forum. That is, I probably wouldn't even have thought the thoughts Iwrote. When this group was first set up, I thought it would need moderation (look at com.lang.* newsgroups for comparison). I've been delightfully pleased that it needs none at all.It's like my experience in the compiler business. I've never needed todealwith the problems that other mail order businesses seem to regularly experience. My conclusion is that the products I make simply attract amuchhigher quality of customer than the competitors do <g>.LOL! :) We can all safely agree with that! -- Stijn OddesE_XYZ hotmail.com http://OddesE.cjb.net _________________________________________________ Remove _XYZ from my address when replying by mail
Jun 26 2002
Agreed. This place is a positive relief from the rough and tumble of other groups, populated by people who seem to care more about impressing others than being helpful/polite. Maybe this is because, in a positive sense, we are all ignorant: D is new. :) "OddesE" <OddesE_XYZ hotmail.com> wrote in message news:afd8d6$2cbd$1 digitaldaemon.com..."Walter" <walter digitalmars.com> wrote in message news:aeb9ef$1c72$1 digitaldaemon.com...has"Robert W. Cunningham" <rcunning acm.org> wrote in message news:3D06B965.445249E6 acm.org...group.As several others have noted before, this is one hell of a specialAndI'm delighted that it has kept its flavor and quality as the D crowd(lookanygrown. I doubt I'd have ever thought to toss my random thoughts intootherforum. That is, I probably wouldn't even have thought the thoughts Iwrote. When this group was first set up, I thought it would need moderationat com.lang.* newsgroups for comparison). I've been delightfully pleased that it needs none at all.But I do think an important part of this is that you are on your own server? I have not yet seen a single spamvertisement here, a great relief! Also, on this group there aren't so many people that flame you to death if you post off topic, if you didn't read the f*cking manual or if you simply disagree with them. I love it here and it is one of the only groups I ever go recently. Posting on or even reading comp.lang.c++ just doesn't seem worth it any more... :(It's like my experience in the compiler business. I've never needed todealwith the problems that other mail order businesses seem to regularly experience. My conclusion is that the products I make simply attract amuchhigher quality of customer than the competitors do <g>.LOL! :) We can all safely agree with that! -- Stijn OddesE_XYZ hotmail.com http://OddesE.cjb.net _________________________________________________ Remove _XYZ from my address when replying by mail
Jun 26 2002
"Robert W. Cunningham" <rcunning acm.org> wrote in message news:3D056A53.CAC0C830 acm.org...Matthew Wilson wrote:awayAnd a very good thing too. Now if we can wean all the terse programmersshouldfrom all their other write-once unmaintain-ever-more practises, wehavereally be cookingReminds me of my own torrid programming past. As a deeply-embedded C programmer for 20 years now, one who was brought up on assembler, I stillthis craven need to write monstrously complex functions in two or threelinesof impenetrable obfuscated C. The goal is to do the most with the fewest keystrokes, yet make the fastest possible code. My peers hated it. My bosses hated it. When I became independent, myclientshated it. But you see, sometimes I just had to do it. I couldn't resist.Iwant to push C down to the level of finely honed assembly macros (whichcan getpositively Forth-like if left to their own devices). And if the rest oftheworld couldn't understand it, well, it just proved they didn't really knowCall that well. Right? To make everyone shut up, I started putting the "correct" code in there as well, then I'd use the preprocessor to switch between the two instances.Icould show the two were functionally equivalent (and on some occasionstheyeven produced the same code). Well, compilers got smarter, the style battles got harder to fight, and programmers got dumber (in a good way ;^). Simple straightforward code iswhateveryone wanted, and I finally caved. Now I use braces and semicolons and parentheses everywhere they can legally go. I no longer pay attention to operator precedence: Parens make that a non-issue in all but a very few cases. I no longer ever have "if" and "else" on the same line, and alwayshavefull brace sets between them. I no longer define structs and enums in-place, even when they arethrow-aways.I use layer upon layer of typedefs to avoid the magic of tangled Gordian Ctypedeclarations. My include files are huge and comprehensive. I usevariablenames with more than one letter, sometimes they may even be found in dictionaries (of some language). Then I started using variable naming conventions, so all my pointers start with p, and member data with m, andso onto the land of the noted Hungarian. Well, I did stop at that last one. Nipped it in the bud. I'm not thatfargone. Not quite yet. But then it got worse: I started using "style guides" and "codingstandards".Then I even started writing the damned things! Then my code started to go through the pretty-printer/reformatter without even a single change.(BTW,"astyle" rocks.) I even started thinking the blasted tools "rocked". I started using lint and "-Wall", and my compiles became warning-free.Pffft.Warnings are feared only by those who don't know what they mean. I had to enter so many more characters in my code that I actually had tostoplooking at the keyboard while I typed. My comment-to-code ratio went from1:10to 2:1, and I even started using documentation generators (which wouldalwaysgag on my old code). I had to go to ever-higher display resolutions on ever-larger displays to get enough code visible in a single window to holdacomplete thought. My functions had only a single entry and exit and were goto-free, witheachloop fully closed, each if else'd. Yes, I truly caved. But I still sneak in the occasional line or two of raw distilledpower-code. Iam a man, dammit! And I can still code my way out of a paper bag. But Ido itwith about 20 lines of surrounding comments. (It feels like wrapping adiamondin burlap.) My "safe" coding has had its cost: I no longer solve those PC-Lintpuzzles ina single glance. Sometimes it takes two glances, taking a pause betweenthemto adjust the reading glasses on my nose. I no longer "see" code in theemptyeditor window, like I did way back when, when the hardest problem wasmaking myeyes keep up with my fingers on the keyboard. Now I actually have to do designs. And do eye exercises. But at least my typing has improved. It allows me to write long,wanderingposts to newsgroups in the blink of an eye. I like D simply because it removes so much of the temptation to delve into obfuscation. The only problem is that I have to fire up a Windows systemtouse it. Did I mention I'm really good on the keyboard? I hate mice. I hatewindowingsystems that don't have keystrokes for doing everything. I hate MSWindows. Ihate that D runs only under Windows. I hate that I have to take down my ultra-stable SMP Linux system, and reboot into Win98 (and give up aprocessor)to run D. But it is worth it, once in a while, if only so I can avoid the seductivesirencall of minimalist C. Somebody shoot me. -BobC PS: D rocks!LOL! :) This is great, and probably should go somewhere in the D Journal! -- Stijn OddesE_XYZ hotmail.com http://OddesE.cjb.net _________________________________________________ Remove _XYZ from my address when replying by mail
Jun 26 2002
How would you qualify an unnamed enum <g>? In any case, I've found anonymous enums to be handy when converting existing C code over. "Matthew Wilson" <dmd synesis.com.au> wrote in message news:adu2pt$1gtv$2 digitaldaemon.com...Yuch! Surely it is better to enforce the qualification. Maintenance costs far exceed original authoring, so who cares about a little effort now? "Walter" <walter digitalmars.com> wrote in message news:adtsm9$1b4s$1 digitaldaemon.com...You won't need to qualify them if you make them anonymous enums, like: enum { red, green, blue }
Jun 08 2002
What I want is an anonymous enum with a name, evidently. ;) Sean "Walter" <walter digitalmars.com> wrote in message news:adu3d5$1hfa$1 digitaldaemon.com...How would you qualify an unnamed enum <g>? In any case, I've found anonymous enums to be handy when convertingexistingC code over. "Matthew Wilson" <dmd synesis.com.au> wrote in message news:adu2pt$1gtv$2 digitaldaemon.com...Yuch! Surely it is better to enforce the qualification. Maintenance costs far exceed original authoring, so who cares about a little effort now? "Walter" <walter digitalmars.com> wrote in message news:adtsm9$1b4s$1 digitaldaemon.com...You won't need to qualify them if you make them anonymous enums, like: enum { red, green, blue }
Jun 08 2002
"Sean L. Palmer" <seanpalmer earthlink.net> wrote in message news:adu3qg$1hsh$1 digitaldaemon.com...What I want is an anonymous enum with a name, evidently. ;)Just make an alias: alias int OLD_C_ENUM; enum { ... } This worked fine for me. =)
Jun 10 2002
It just seems kludgy; It's the behavior I'd want from enums to begin with. But that may be just because I come from a C++ background where enums do work like this. In fact to be perfectly compatible with C++ enum, it'd have to be completely rewritten: instead of : // in C++ enum Colors { red, green, blue }; // in D typedef uint Colors; public const Colors red = Colors(0); public const Colors green = Colors(1); public const Colors blue = Colors(2); Now that sucks. Sean "Pavel Minayev" <evilone omen.ru> wrote in message news:ae34ko$l9e$1 digitaldaemon.com..."Sean L. Palmer" <seanpalmer earthlink.net> wrote in message news:adu3qg$1hsh$1 digitaldaemon.com...What I want is an anonymous enum with a name, evidently. ;)Just make an alias: alias int OLD_C_ENUM; enum { ... } This worked fine for me. =)
Jun 10 2002
"Sean L. Palmer" <seanpalmer earthlink.net> wrote in message news:ae41t3$1i6q$1 digitaldaemon.com...It just seems kludgy; It's the behavior I'd want from enums to beginwith.But that may be just because I come from a C++ background where enums do work like this. In fact to be perfectly compatible with C++ enum, it'd have to becompletelyrewritten: instead of : // in C++ enum Colors { red, green, blue }; // in D typedef uint Colors; public const Colors red = Colors(0); public const Colors green = Colors(1); public const Colors blue = Colors(2);Not necessary: typedef uint Colors; enum : Colors { red, green, blue }; note the colon.
Jun 10 2002
"Walter" <walter digitalmars.com> wrote in message news:ae47lc$1p4a$1 digitaldaemon.com...completely rewritten:In fact to be perfectly compatible with C++ enum, it'd have to beWhat does the colon do, again?instead of : // in C++ enum Colors { red, green, blue }; // in D typedef uint Colors; public const Colors red = Colors(0); public const Colors green = Colors(1); public const Colors blue = Colors(2);Not necessary: typedef uint Colors; enum : Colors { red, green, blue }; note the colon.
Jun 11 2002
"Sean L. Palmer" wrote:"Walter" <walter digitalmars.com> wrote in message news:ae47lc$1p4a$1 digitaldaemon.com...It defines the underlying type of the enum, rather than letting the compiler select it. -- The Villagers are Online! villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ]completely rewritten:In fact to be perfectly compatible with C++ enum, it'd have to beWhat does the colon do, again?instead of : // in C++ enum Colors { red, green, blue }; // in D typedef uint Colors; public const Colors red = Colors(0); public const Colors green = Colors(1); public const Colors blue = Colors(2);Not necessary: typedef uint Colors; enum : Colors { red, green, blue }; note the colon.
Jun 11 2002
"Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message news:3D0647B6.C88EE81F deming-os.org..."Sean L. Palmer" wrote:Yes. If you think about it as being like selecting a "base class", the syntax makes sense.What does the colon do, again?It defines the underlying type of the enum, rather than letting the compiler select it.
Jun 13 2002
Yes, sounds cool. Sean "Walter" <walter digitalmars.com> wrote in message news:aeanc7$p3f$3 digitaldaemon.com..."Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message news:3D0647B6.C88EE81F deming-os.org..."Sean L. Palmer" wrote:Yes. If you think about it as being like selecting a "base class", the syntax makes sense.What does the colon do, again?It defines the underlying type of the enum, rather than letting the compiler select it.
Jun 14 2002