|
haha that is great
the only place u should see hex numbers is Hardware.h imho
|
|
|
|
|
I will confess to having used hex-ish variable names in code for certain hardware ports which didn't have standardized names. I've also used hex-ish defined constants for colors which needed to be remappable to different hardware (an NTSC system used $1x for gold, $4x for red, $8x for blue, $Cx for green, and $Fx for green-yellow; PAL systems mapped the colors completely differently). Although there are defined names for colors, I find it much easier to know that $3x is an almost red orange than to remember whether "ORANGE" refers to $2x or $3x.
Those things having been said, the code here looks like it may have been obfuscated.
|
|
|
|
|
Ummm, no
I'm very fond of adding flag words to objects instead of doing something horrible like adding countless bool members. Usually they are an enumerated type and defining them in anything than hex is awkward. Like this:
[flags]
public enum D_SOMEFLAGS : ulong
{
NONE = 0x0000000000000000,
VALIDATED = 0x0000000000000001,
CHANGED = 0x0000000000000002,
}
But I agree that hex notation should only be used in variable names on rare occasions.
A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.
I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
|
|
|
|
|
well we arent really in disagrement because when using this you will never see the values set only the symbols which is fine, good practise for saving memory infact.
the conatations i was implying was that hex numbers should be out of the way.
|
|
|
|
|
Yikes. That looks like something to do on a project when one is about to leave a company [evil grin]...
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Looks like this variable determines whether an object has a particular set of flags. If there would be, let say, 10 flags, then a 'meaningful' name would have to be "IsFlag1AndFlag2AndFlag3And....AndFlag10AndNothingElse = false "
So, for the author of a flag's enumeration this is just a short form of the above.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
A few posts above I also commented on flags.
[flags]
public enum D_SOMEFLAGS : ulong
{
NONE = 0x0000000000000000,
VALIDATED = 0x0000000000000001,
CHANGED = 0x0000000000000002,
}
would it not be better (using my example there) to add something like
...
CHANGED_AND_VALIDATED = 0x0000000000000003;
...
to the enumeration?
A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.
I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
|
|
|
|
|
Yes and I add such extra pieces to enumerations too. However, in the situation I mentioned there are a lot of various flags and the additional enum member would look sth like
CHANGED_AND_VALIDATED_AND_FLAG3_AND_FLAG5_AND_FLAG11_AND_FLAG12_AND_.... = some code
I have nothing against long names in programming but if a name of one of constants starts taking more than 10% of a whole method content then something is going wrong I think.
Although 0x0301 contains just three flags, it's very simple to determine which flags are used (x0100 , x0200 and x0001 ), therefore there is nothing bad in ecode boolean names.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
True, but in that case usually some kind of operation is associated with a particular combination of flags. You might use the name of this operation instead of naming all Flags involved. You can still elaborate in the comments. Something like this:
...
MODIFIED_BY_USER = 0x90aebeee7a3f017b,
...
A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.
I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
|
|
|
|
|
Dammmit we still agree. I was thinking of it when I was posting my message and wondering if you express that. Hmm I think we have a dead end in this discussion. Cool signature by the way.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
Agreement is the best conclusion we can reach.
Until next time then.
A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.
I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
|
|
|
|
|
HTML
Please, who decided that tags like <br> didn't have to be closed. Now parsers have to waste their time checking for a closing tag. Also, how could people think that <b><i></b></i> is ok? And what about <div><div></div>?
And what about JavaScript and the like? Why consider ' and " only within a script tag, and then allow <, but outside a script tag treat any instance of < as a tag opener?
People's laziness in writing HTML slows down my computer by wasting processing.
But seriously, why did people decide that HTMLers would be too stupid/lazy to close tags and layer them correctly?
|
|
|
|
|
To add to it, how hard would it be to write an HTML editor that closes the tags for those lazy HTMLers
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
My favourite part was when the OP forgot to tick the "Ignore HTML tags in this message (good for code snippets) checkbox!!
--------------------------------------------------------
Knowledge is knowing that the tomato is a fruit.
Wisdom is not putting it in fruit salad!!
|
|
|
|
|
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
<b><i></i></b> Looks OK to me.
|
|
|
|
|
Fixed
|
|
|
|
|
Actually, that is what makes the web so great. By lowering the barrier to entry it let many people without technical skills get information out. If we raise the level of skill to put out a simple web page, then we'll leave some people out. Anybody that likes and gets serious will want to get better to do more complex things. Or they'll get a copy of Frontpage (or something like that).
Hogan
|
|
|
|
|
Yes, but closing tags in order and closing all tags is not complicated at all, and no technical skills are required to do so.
|
|
|
|
|
I have to agree. It just isn't that hard to properly format tag.
Bill W
|
|
|
|
|
jamie550 wrote: Also, how could people think that is ok?
Because when applying that formatting in your favorite word processor you only need to apply bold and italic once each. You don;t have to apply one separately on each side of the other. Having learned how to do the task one way, a user will always try to do a conceptually similar task the same way in other applications.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
dan neely wrote: Because when applying that formatting in your favorite word processor you only need to apply bold and italic once each. You don;t have to apply one separately on each side of the other. Having learned how to do the task one way, a user will always try to do a conceptually similar task the same way in other applications.
This is not true, in WordPerfect For DOS you must start a Bold section and then close the bold section. The same for italic and underline.
Learn from the mistakes of others, you may not live long enough to make them all yourself.
|
|
|
|
|
Which would mean that the 5% of lusers who learned word processing on WP would get it right, but the 95% whose first PC had a GUI would still be doing it the wrong way.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
jamie550 wrote: But seriously, why did people decide that HTMLers would be too stupid/lazy to close tags and layer them correctly?
That was an excellent guess, as a matter of fact. People _are_ too lazy to close tags, a chance that some people realized that.
|
|
|
|
|
who decided that tags like <br> didn't have to be closed
Well, that's named HTML, and it have been around for many years. Way before XML was invented...
Now parsers have to waste their time checking for a closing tag
You just have to use an HTML parser, using the right DTD, indicating which tags must be closed and which might be left "open", and what is their scope (closed by another kind of tag), instead of an XML parser...
Incorrect HTML: that's another story, that's why browsers are so tolerant (more or less: a browser might close a div by itself, another will take the div ends at the bottom of the document...).
I don't understand the rant about JS...
Anyway, should I have to parse HTML pages, I would use a good library like TagSoup to handle all these peculiarities.
|
|
|
|