top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

What is strong-typing versus weak-typing? Which is preferred? Why?

0 votes
What is strong-typing versus weak-typing? Which is preferred? Why?
posted Jun 19, 2017 by Amit Sharma

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Strong typing: It checks the type of variables as soon as possible, usually at compile time. It prevents mixing operations between mismatched types.

A strong-typed programming language is one in which:

All variables (or data types) are known at compile time
There is strict enforcement of typing rules (a String can't be used where an Integer would be expected)
All exceptions to typing rules results in a compile time error

Weak Typing: While weak typing is delaying checking the types of the system as late as possible, usually to run-time. In this you can mix types without an explicit conversion.

A "weak-typed" programming language is simply one which is not strong-typed.

which is preferred depends on what you want. for scripts and good stuff you will usually want weak typing, because you want to write as much less code as possible. in big programs, strong typing can reduce errors at compile time.

answer Jun 23, 2017 by Shweta Singh
Similar Questions
+2 votes

Why is it preferred to not use finalize for clean up?

+3 votes

How to Sign an Assembly with a Strong Name?

0 votes

How to implement an Object Pool in C#.NET.

Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.