Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
W

WilliamSauron

@WilliamSauron
About
Posts
18
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to chose self explanatory parameter names
    W WilliamSauron

    Our low-level embedded communication servers use a .INI file for configurable parameters. There is a [send] section, and a [receive] section. The [send] section contains an aptly named SendRetryCount parameter. In one of the drivers, we also need a ReceiveRetryCount parameter. Guess where the programmer chose to place it. If your bet was the [receive] section, you lose. It is of course in the [send] section...

    -- Quidquid latine dictum sit, altum sonatur. http://streambolics.flimbase.com S. L.

    The Weird and The Wonderful com hardware tutorial learning

  • :(
    W WilliamSauron

    The problem with a movie where the human race loses and is wiped from this side of the universe is that it precludes the possibility of a sequel. I know that Star TWraerks solved this by inventing the prequel, but anyway big studios like big certitudes. BTW, how do you say "may the Force be with you" in Klingon ?

    -- Quidquid latine dictum sit, altum sonatur. http://streambolics.flimbase.com S. L.

    The Lounge csharp com question

  • :(
    W WilliamSauron

    Suspension of disbelief is a powerful concept :-) Having fun watching Star Trek (or Tom & Jerry, or Hannah Montana by the way) doesn't imply that we believe it's going to happen, nor that it's even remotely possible, let alone desirable. I myself believe humans will never manage to escape Earth (which itself may be the only sentient-life-carrying-planet in the local cluster.) I nevertheless enjoyed watching the movie.

    -- Quidquid latine dictum sit, altum sonatur. http://streambolics.flimbase.com S. L.

    The Lounge csharp com question

  • I just saw this beauty today...
    W WilliamSauron

    No, but if you write:

    int foo ()
    {
    string *s = null;
    return s->length();
    }

    the string::length function will be called with this==null. This could be used so that the null string would behave as the empty string.

    -- Quidquid latine dictum sit, altum sonatur. http://streambolics.flimbase.com S. L.

    The Weird and The Wonderful

  • I just saw this beauty today...
    W WilliamSauron

    Call a method passing a null object... In Delphi, the Free method checks that it was called for an object that was really created. It's quite useful, since you can write "MyObject.Free" instead of "if Assigned(MyObject) then MyObject.Free;". A real time saver, and code is so much more readable.

    -- Quidquid latine dictum sit, altum sonatur. http://streambolics.flimbase.com S. L.

    The Weird and The Wonderful

  • I need a dictionary
    W WilliamSauron

    Dalek Dave wrote:

    Capital J surely?

    Ooops ! Indeed ! Sorry, English being only my third language, I sometimes make silly mistakes like forgetting to use uppercase for capitals where appropriate, and misplace punctuation marks. You may have seen the space before the exclamation marks, which is a sign that I usually try to stick to French typography rules. Don't mention the mistakes I make in Klingon (which is actually a language that I don't speak, but in which, I suspect, the genitive is strongly enforced due to its 'possessive' nature.)

    Dalek Dave wrote:

    Also, it is in this case July that is the Genitive, although I would wonder, as Fourth is an Adjective, not a Noun possibly?

    Let's assume for a few microfortnights that "4th of July" is the short form for "The fourth day belonging to the month named July itself belonging to either an unspecified year, or all years when the appropriate calendar was in use and when it actually mattered that it was that particular day, maybe because the streets were closed to traffic due to some celebration." In that case the noun would be "day". I imagine however that for some unspecified reason, most people prefer the short form, especially when they are born on that day. However, seeing the quote in your signature, is it safe to infer that you are either unaffected by the celebrations taking place on the day we just mentioned, or sad that your country lost a colony populated by people who chose Cardiff to sail to the New World ? [please insert here any sign that would indicate that everything I said was meant to entertain you]

    -- Quidquid latine dictum sit, altum sonatur. http://streambolics.flimbase.com S. L.

    The Lounge question html com tools tutorial

  • I need a dictionary
    W WilliamSauron

    "Genitive" is useful for people writing in German (and many other germanic languages,) Russian (and many other slavic languages.) Sorry for all those I forgot to mention. Oh, by the way, "4th of july" is actually the genitive form :-)

    -- Quidquid latine dictum sit, altum sonatur. http://streambolics.flimbase.com S. L.

    The Lounge question html com tools tutorial

  • I need a dictionary
    W WilliamSauron

    Hans Dietrich wrote:

    all it really means is possessive. Why not just say that?

    Because "Genitive" has a very precise meaning, and is actually the appropriate word in that case (pun intended), even if some people don't know what it means. As a computer specialist, you probably use words like "DHCP lease", "preemptive multitasking", "packet switching" that most users don't understand; you would probably not want to use another, less appropriate word instead...

    -- Quidquid latine dictum sit, altum sonatur. http://streambolics.flimbase.com S. L.

    The Lounge question html com tools tutorial

  • Bizarre fish photo
    W WilliamSauron

    OOps, I just downvoted this post by pressing the wrong button... Sorry for that; how do I un-vote ?

    -- Quidquid latine dictum sit, altum sonatur. http://streambolics.flimbase.com S. L.

    The Lounge html com announcement career

  • C++: Reading an ifstream
    W WilliamSauron

    A newline at the end of a comment is worth two in the bush.

    -- Quidquid latine dictum sit, altum sonatur. http://streambolics.flimbase.com S. L.

    Clever Code c++ graphics json help question

  • 'Item': member names cannot be the same as their enclosing type
    W WilliamSauron

    Okay, your mission, should you choose to accept it, is to provide one single example where "Item" is an appropriate name for a collection class :-) If you get caught or killed, the moderator will disavow any knowledge of this thread (which will self destruct in five seconds anyway)

    -- Quidquid latine dictum sit, altum sonatur. http://streambolics.flimbase.com S. L.

    The Weird and The Wonderful csharp help

  • 'Item': member names cannot be the same as their enclosing type
    W WilliamSauron

    There is no need to have a way around it through an attribute. If a class has an indexer, then it is a collection of some other things; "Item" is therefore not a good name for that class. It is a Coding Horror. Give the class an appropriate name, and you don't need the attribute...

    -- Quidquid latine dictum sit, altum sonatur. http://streambolics.flimbase.com S. L.

    The Weird and The Wonderful csharp help

  • 'Item': member names cannot be the same as their enclosing type
    W WilliamSauron

    PIEBALDconsult wrote:

    True, but it would still likely generate the same name, for convenience

    Yes, and since in some assembler languages (the one that comes to mind is Compass but there are others,) labels beginning with a dot must be local, that would make sure your constructors cannot be called from outside your module.

    PIEBALDconsult wrote:

    My copies of the MS and ECMA specs say the same thing... it's an identifier, not a name.

    Yes, if you prefer calling that an identifier instead of a name (let's not reach for the scissors and talk about the subtle semantic differences between a name and an identifier.) But still a method identifier, not a type identifier. Last time I looked, the identifier denoting a constructor in my Visual Studio editor had the same black color as another method identifier, not the greenish color of my class identifier. Are they all color blind at Microsoft?

    -- Quidquid latine dictum sit, altum sonatur. http://streambolics.flimbase.com S. L.

    The Weird and The Wonderful csharp help

  • 'Item': member names cannot be the same as their enclosing type
    W WilliamSauron

    PIEBALDconsult wrote:

    Which is the only name that matters

    Unless you target another architecture than the CLR, of course, in which case you are free to name generated symbols as you see fit. Who said that it is forbidden to directly generate IBM 360 assembly from C# ?

    PIEBALDconsult wrote:

    That's funny, I know that if a method is declared that has no name and returns an instance of the class, it is a constructor.

    Funnier, my copy of "The C# Programming Language", ISBN 0-321-15491-6 by Anders Hejlsberg, Scott Wiltamuth & Peter Golde, on chapter 10.10 "Instance Constructors", page 344 has strong hints that they understand the constructor name to be similar to a method name, not a type name:

    The identifier of a constructor-declarator must name the class in which the instance constructor is declared. If any other name is specified, a compile-time error occurs.

    Similarly, my Visual Studio highlights the constructor as a method name, not as a type. But hey, Visual Studio is a Microsoft product, these are known not to follow recognized standards. And who knows, maybe this Hejlsberg guy is just a newbie :-)

    -- Quidquid latine dictum sit, altum sonatur. http://streambolics.flimbase.com S. L.

    The Weird and The Wonderful csharp help

  • 'Item': member names cannot be the same as their enclosing type
    W WilliamSauron

    Ok, it's time for a little nitpicking then :-) (or, as we say in French, cutting hairs in four). Beware, I've 44 years of experience at that game :-) It means that everything I say here has absolutely no importance at all, and is by no way an attack on anyone. It's just saying something for the pleasure of saying something. The ".ctor" is not a C# name, it is a CLR/MSIL/whatever name. When I write a constructor for my C# class, I dont type ".ctor", I type the name of my class as the name of the method. Now, whether the compiler has an urgent need to create MSIL code named ".ctor" or "Groborozgruduruk" is totally irrelevant. When I program in C#, and also when I read C# code written by anyone else, I know that if a method is declared that has the same name as the class, it is a constructor. In Delphi, type casts use the same syntax as a function call, so having a function and a type with the same name is not a good idea there neither. Other languages may still have other good reasons to abhor that. This is a good reason why I agree with the compiler when it insists that I don't call my method the same name as the class. This brings the second question: as the compiler internally creates a method named "Item" as the implementation of the default indexer, does it really impose an unbearable burden on the creativity of programmers? Of course, it means that you cannot have a class named "Item" that has an indexer. But wait! Do you really think a good design would involve a class named very generically "Item" that has a default indexer (and so is itself composed of a collection of something else.) What are these called then? "SubItem" maybe? What if SubItem has itself an indexer? "SubSubItem"? "YetAnoterSubItem"? If you don't give meaningful names to your classes and methods, you are of course welcome to do so, but please don't say the compiler is restricting your creativity :-) On the other hand, now we know where the coding horror is :-)

    -- Quidquid latine dictum sit, altum sonatur. http://streambolics.flimbase.com S. L.

    The Weird and The Wonderful csharp help

  • 'Item': member names cannot be the same as their enclosing type
    W WilliamSauron

    Yes, I actually hoped it was so :-) What I meant is that the limitation is somehow "logical". I don't find logical to have a class named "Fibonacci" that has a method named "Fibonacci". I would rather expect methods like "generate" or "next".

    -- Quidquid latine dictum sit, altum sonatur. http://streambolics.flimbase.com S. L.

    The Weird and The Wonderful csharp help

  • 'Item': member names cannot be the same as their enclosing type
    W WilliamSauron

    In C# and C++ a method that has the same name as the class itself is called a "constructor"...

    -- Quidquid latine dictum sit, altum sonatur. http://streambolics.flimbase.com S. L.

    The Weird and The Wonderful csharp help

  • "What is this?"
    W WilliamSauron

    Alt-F4 has *ALWAYS* closed the entire application. If you want to close only one of the sub-windows (MDI children as they were called, or their new incarnation, tabs) use Ctrl-F4 instead... S.L.

    The Lounge question help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups