Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Grizwald

Strong vs. Weak Typing

This topic is 5580 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

what are the advantages of a strong typing system vs a weaker system. I consider a langage like c++ to have strong typing, and BASIC to have weaker typing. that could be a bad assumption. so feel free to correctly. also, which is better for game programming? thanks.

Share this post


Link to post
Share on other sites
Advertisement
Umm.. I don''t really understand by what you mean by having a strong typing system, but for begginning game programming, I think basic is good, however, if you want to get into the nitty gritty of game programming, c++ is definetly better :D.

Share this post


Link to post
Share on other sites
I think he means the difficulty to keyboard without two-finge-typing.

There''s no town drunk here, we all take turns.

Share this post


Link to post
Share on other sites
Umm... OK, for all of you that son''t know, strong typing is when a language enforces types, like int, etc. In c++ you can covnert an int to a double simply with double whatever= int whatever, whereas in java you need to use special functions. It''s really a matter of taste, and C++ is in the middle.

-~-The Cow of Darkness-~-

Share this post


Link to post
Share on other sites
cows,

sadly, your one example (int-to-double) is allowed in C++ There are some implicit casts still in the language. Also, in Java for native types you use casts as well (not "special functions").

Regards,
Jeff

[edited by - rypyr on May 5, 2003 9:06:02 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by rypyr
cows,

sadly, your one example (int-to-double) is allowed in C++ There are some implicit casts still in the language. Also, in Java for native types you use casts as well (not "special functions").

Regards,
Jeff

[edited by - rypyr on May 5, 2003 9:06:02 PM]


I said it was allowed. And java''s casts are special functions, aren''t they?

-~-The Cow of Darkness-~-

Share this post


Link to post
Share on other sites
strong versus weak typing, IMHO, is something of a misnomer; as CANE so adroitly pointed out, "strongly typed" languages such as C often allow quite a bit of type coercion. I think a better distinction would be "variable typing" versus "object typing". With the former, a particular variable assumes a particular type, which is known at compile time and which persists thoughout the variable''s scope. With object typing, a variable has no particular type of its own, but rather stores an object, which has its own type.

I prefer weakly typed scripting languages... easier for beginning programmers to understand. In languages such as C, however, strong typing can lead to greater efficiency, especially in function calls.


How appropriate. You fight like a cow.

Share this post


Link to post
Share on other sites
I said it was allowed. And java''s casts are special functions, aren''t they?

No. You can say something like (int)(2.5). You can do the same thing in C++.

Share this post


Link to post
Share on other sites
quote:
Original post by yaroslavd
I said it was allowed. And java''s casts are special functions, aren''t they?

No. You can say something like (int)(2.5). You can do the same thing in C++.


Oh, really? I always used something like double.toint (I don''t remember exactly).. oh well



-~-The Cow of Darkness-~-

Share this post


Link to post
Share on other sites
Oh, really? I always used something like double.toint (I don''t remember exactly).. oh well

Yeah, you COULD do that, but you don''t need to. You could just do it the way I described.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!