This bugs me...

This is a discussion on This bugs me... within the C# Programming forums, part of the General Programming Boards category; Data types in C# have stupid names. byte - It's unsigned. Ok, that's reasonable so far. sbyte - Signed byte. ...

  1. #1
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826

    This bugs me...

    Data types in C# have stupid names.

    byte - It's unsigned. Ok, that's reasonable so far.
    sbyte - Signed byte. I guess that's alright.
    int - Ok, an integer. It's signed. What?
    uint - This is an unsigned int?

    Why isn't it sint or ubyte? Don't mix them. If I can use s<type> for signed, then use s<type> for all of them. Don't use s for some and u for others!


    Quzah.
    Hope is the first step on the road to disappointment.

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,412
    Yeah. Not nice to see. I don't know why they would be named like that, but I can haphazard a guess: Code simplicity, provided you understand the meaning of the data types; Unsigned byte is a more common data type, than signed byte for sure. So "byte" it is. Conversely, a signed integer is by far a more common data type than a signed one. So... yeah.

    In any case, the problem goes away if you use the CLS compliant names (which we probably should anyways). In that case we have:

    Int16 - signed
    UInt16 - unsigned
    Int32 - signed
    UInt32 - unsigned
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    Cat
    Cat is offline
    Registered User
    Join Date
    May 2003
    Posts
    1,571
    That's exactly it - it's all about frequency of use. byte and char are unsigned, while short, int, and long are signed, because those are simply the most common uses of those data types. It's a departure from C/C++ where everything defaults to signed unless you use the unsigned keyword.

    While it may make the learning curve a bit steeper, once you're familiar with the language you'll come to appreciate it I think, since it makes the most commonly used form the shortest, and the one that doesn't need any special prefixes.
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Bugs!
    By LeighRogers in forum C++ Programming
    Replies: 7
    Last Post: 05-13-2007, 07:33 AM
  2. Where is the bugs?!
    By Mathsniper in forum C Programming
    Replies: 6
    Last Post: 05-16-2006, 01:02 AM
  3. Need help finding bugs
    By Shakti in forum Game Programming
    Replies: 16
    Last Post: 02-13-2005, 12:42 AM
  4. Some site bugs
    By chrismiceli in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 08-11-2004, 10:35 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21