D - enum
- "Sean L. Palmer" <seanpalmer earthlink.net> Jun 08 2002
- "Walter" <walter digitalmars.com> Jun 08 2002
- "Matthew Wilson" <dmd synesis.com.au> Jun 08 2002
- "Sean L. Palmer" <seanpalmer earthlink.net> Jun 08 2002
- "Matthew Wilson" <dmd synesis.com.au> Jun 08 2002
- "Pavel Minayev" <evilone omen.ru> Jun 10 2002
- "Matthew Wilson" <dm synesis-group.com> Jun 10 2002
- "Robert W. Cunningham" <rcunning acm.org> Jun 10 2002
- "Matthew Wilson" <dm synesis-group.com> Jun 10 2002
- "Walter" <walter digitalmars.com> Jun 10 2002
- "Roberto Mariottini" <rmariottini lycosmail.com> Jun 11 2002
- "Matthew Wilson" <dmd synesis.com.au> Jun 11 2002
- "Robert W. Cunningham" <rcunning acm.org> Jun 11 2002
- "Walter" <walter digitalmars.com> Jun 13 2002
- "OddesE" <OddesE_XYZ hotmail.com> Jun 26 2002
- "Matthew Wilson" <matthew thedjournal.com> Jun 26 2002
- "OddesE" <OddesE_XYZ hotmail.com> Jun 26 2002
- "Walter" <walter digitalmars.com> Jun 08 2002
- "Sean L. Palmer" <seanpalmer earthlink.net> Jun 08 2002
- "Pavel Minayev" <evilone omen.ru> Jun 10 2002
- "Sean L. Palmer" <seanpalmer earthlink.net> Jun 10 2002
- "Walter" <walter digitalmars.com> Jun 10 2002
- "Sean L. Palmer" <seanpalmer earthlink.net> Jun 11 2002
- Russ Lewis <spamhole-2001-07-16 deming-os.org> Jun 11 2002
- "Walter" <walter digitalmars.com> Jun 13 2002
- "Sean L. Palmer" <seanpalmer earthlink.net> Jun 14 2002
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...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
could 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...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
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
members to be globally accessible. I'd change them to const int etc
they really are an enum and I'd lose typechecking capability. I
Icould 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 wordy
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...
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
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
members to be globally accessible. I'd change them to const int etc
they really are an enum and I'd lose typechecking capability. I
I
could 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 putting
in everywhere, so let's just admit that the odd bit of typing now will
masses 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 compare
against 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-prone
You 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 putting
in everywhere, so let's just admit that the odd bit of typing now will
masses 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 compare
against 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-prone
You 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 cooking
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 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 hell out of Java and C# (I know Walter doesn't see it as a competitor for 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:And a very good thing too. Now if we can wean all the terse programmers
from all their other write-once unmaintain-ever-more practises, we
really be cooking
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 still
this craven need to write monstrously complex functions in two or three
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
hated it. But you see, sometimes I just had to do it. I couldn't resist.
want to push C down to the level of finely honed assembly macros (which
positively Forth-like if left to their own devices). And if the rest of
world couldn't understand it, well, it just proved they didn't really know
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.
could show the two were functionally equivalent (and on some occasions
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
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
full brace sets between them. I no longer define structs and enums in-place, even when they are
I use layer upon layer of typedefs to avoid the magic of tangled Gordian C
declarations. My include files are huge and comprehensive. I use
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
to the land of the noted Hungarian. Well, I did stop at that last one. Nipped it in the bud. I'm not that
gone. Not quite yet. But then it got worse: I started using "style guides" and "coding
Then I even started writing the damned things! Then my code started to go through the pretty-printer/reformatter without even a single change.
"astyle" rocks.) I even started thinking the blasted tools "rocked". I started using lint and "-Wall", and my compiles became warning-free.
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
looking at the keyboard while I typed. My comment-to-code ratio went from
to 2:1, and I even started using documentation generators (which would
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
complete thought. My functions had only a single entry and exit and were goto-free, with
loop fully closed, each if else'd. Yes, I truly caved. But I still sneak in the occasional line or two of raw distilled
am a man, dammit! And I can still code my way out of a paper bag. But I
with about 20 lines of surrounding comments. (It feels like wrapping a
in burlap.) My "safe" coding has had its cost: I no longer solve those PC-Lint
a single glance. Sometimes it takes two glances, taking a pause between
to adjust the reading glasses on my nose. I no longer "see" code in the
editor window, like I did way back when, when the hardest problem was
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,
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
use it. Did I mention I'm really good on the keyboard? I hate mice. I hate
systems that don't have keystrokes for doing everything. I hate MS
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
to run D. But it is worth it, once in a while, if only so I can avoid the seductive
call 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 still
this craven need to write monstrously complex functions in two or three
of 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...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
havethis craven need to write monstrously complex functions in two or three
of impenetrable obfuscated C. The goal is to do the most with the
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
<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...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
havethis craven need to write monstrously complex functions in two or three
of impenetrable obfuscated C. The goal is to do the most with the
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
"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.
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
forum. That is, I probably wouldn't even have thought the thoughts I
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...As several others have noted before, this is one hell of a special
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
otherforum. That is, I probably wouldn't even have thought the thoughts I
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.
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 to
with the problems that other mail order businesses seem to regularly experience. My conclusion is that the products I make simply attract a
higher 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..."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
AndI'm delighted that it has kept its flavor and quality as the D crowd
grown. I doubt I'd have ever thought to toss my random thoughts into
otherforum. That is, I probably wouldn't even have thought the thoughts I
When this group was first set up, I thought it would need moderation
at 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 to
with the problems that other mail order businesses seem to regularly experience. My conclusion is that the products I make simply attract a
higher 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:And a very good thing too. Now if we can wean all the terse programmers
from all their other write-once unmaintain-ever-more practises, we
really be cooking
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 still
this craven need to write monstrously complex functions in two or three
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
hated it. But you see, sometimes I just had to do it. I couldn't resist.
want to push C down to the level of finely honed assembly macros (which
positively Forth-like if left to their own devices). And if the rest of
world couldn't understand it, well, it just proved they didn't really know
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.
could show the two were functionally equivalent (and on some occasions
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
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
full brace sets between them. I no longer define structs and enums in-place, even when they are
I use layer upon layer of typedefs to avoid the magic of tangled Gordian C
declarations. My include files are huge and comprehensive. I use
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
to the land of the noted Hungarian. Well, I did stop at that last one. Nipped it in the bud. I'm not that
gone. Not quite yet. But then it got worse: I started using "style guides" and "coding
Then I even started writing the damned things! Then my code started to go through the pretty-printer/reformatter without even a single change.
"astyle" rocks.) I even started thinking the blasted tools "rocked". I started using lint and "-Wall", and my compiles became warning-free.
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
looking at the keyboard while I typed. My comment-to-code ratio went from
to 2:1, and I even started using documentation generators (which would
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
complete thought. My functions had only a single entry and exit and were goto-free, with
loop fully closed, each if else'd. Yes, I truly caved. But I still sneak in the occasional line or two of raw distilled
am a man, dammit! And I can still code my way out of a paper bag. But I
with about 20 lines of surrounding comments. (It feels like wrapping a
in burlap.) My "safe" coding has had its cost: I no longer solve those PC-Lint
a single glance. Sometimes it takes two glances, taking a pause between
to adjust the reading glasses on my nose. I no longer "see" code in the
editor window, like I did way back when, when the hardest problem was
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,
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
use it. Did I mention I'm really good on the keyboard? I hate mice. I hate
systems that don't have keystrokes for doing everything. I hate MS
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
to run D. But it is worth it, once in a while, if only so I can avoid the seductive
call 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 converting
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
"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 begin
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
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);
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...In fact to be perfectly compatible with C++ enum, it'd have to be
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.
What does the colon do, again?
Jun 11 2002
"Sean L. Palmer" wrote:"Walter" <walter digitalmars.com> wrote in message news:ae47lc$1p4a$1 digitaldaemon.com...In fact to be perfectly compatible with C++ enum, it'd have to be
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.
What does the colon do, again?
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))) ]
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:What does the colon do, again?
compiler select it.
Yes. If you think about it as being like selecting a "base class", the syntax makes sense.
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:What does the colon do, again?
compiler select it.
Yes. If you think about it as being like selecting a "base class", the syntax makes sense.
Jun 14 2002









"Matthew Wilson" <dm synesis-group.com> 