xboxscene.org forums

Author Topic: Defining Your Own Types  (Read 74 times)

razorrifh

  • Archived User
  • Sr. Member
  • *
  • Posts: 329
Defining Your Own Types
« on: April 19, 2004, 01:45:00 PM »

CODE
uint32
uint16


blah blah.

the only thing i can see is for portability's sake. or maybe for different compilers to know what size you really want the varialbe to be. can anyone expand upon this for me or do i already understand? it just frustrates me for no reason really  tongue.gif
Logged

Carcharius

  • Archived User
  • Sr. Member
  • *
  • Posts: 304
Defining Your Own Types
« Reply #1 on: April 20, 2004, 01:34:00 PM »

and it can save typing too!

ie

uint8

is wayyy less typing  than

unsigned short
Logged

xbill

  • Archived User
  • Jr. Member
  • *
  • Posts: 91
Defining Your Own Types
« Reply #2 on: April 22, 2004, 09:11:00 PM »

You're getting way to worked up over variable types.

Back before CPUs and OSes were 64, or 32 bit, there were 16 bit CPUs and OSes.  If your target system was 16 bit you might change the way things are declared.    

uint16 and uint32 are most likely artifacts from the transition from win16 to win32.

You mostly answered this yourself.   Different platforms, and different compilers treat types slightly diffrently.   One environment might treat an int as 16 bit, another might allocate 32.   Although, most environments today are 32 bit.

If you declare a variable with a meaningful name to match its size, there will be little doubt about it when you need to use it.

Programmers can define what ever variable types they want to.  Just because you don't understand their code, or their motivation, does not mean that their actions, and variable types, are silly.

----

How is a forum signature with xbox specs in it anything like drinking and driving?

Sure, a signature is a little boastful, but it lets others know that you know a little about modding.    It's friendly competition, too.    There's nothing wrong with that, is there?     If you choose not to do it, or don't like it, that doesn't mean its stupid.    More importantly, it has no comparison to drinking and driving.  

Logged

razorrifh

  • Archived User
  • Sr. Member
  • *
  • Posts: 329
Defining Your Own Types
« Reply #3 on: April 26, 2004, 12:48:00 PM »

QUOTE (xbill @ Apr 23 2004, 01:11 AM)
You're getting way to worked up over variable types.

Back before CPUs and OSes were 64, or 32 bit, there were 16 bit CPUs and OSes.  If your target system was 16 bit you might change the way things are declared.   

uint16 and uint32 are most likely artifacts from the transition from win16 to win32.

You mostly answered this yourself.   Different platforms, and different compilers treat types slightly diffrently.   One environment might treat an int as 16 bit, another might allocate 32.   Although, most environments today are 32 bit.

If you declare a variable with a meaningful name to match its size, there will be little doubt about it when you need to use it.

Programmers can define what ever variable types they want to.  Just because you don't understand their code, or their motivation, does not mean that their actions, and variable types, are silly.

----

How is a forum signature with xbox specs in it anything like drinking and driving?

Sure, a signature is a little boastful, but it lets others know that you know a little about modding.    It's friendly competition, too.    There's nothing wrong with that, is there?     If you choose not to do it, or don't like it, that doesn't mean its stupid.    More importantly, it has no comparison to drinking and driving.

hm, i still find it silly but i do understand the reasonings behind it. maybe if i got more into cross platform developement or actually program for a purpose i'd care a bit more or change my mind.

and my sig is a joke. its humorous; i guess it just missed its intended target with you smile.gif and it does relate because i find both stupid, but thats just my opinion.
Logged