Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "statically typed" and "free-form" mean for C++?

Tags:

c++

In the C++ tag wiki, it is mentioned that

C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language.

Can someone please explain the terms "statically typed" and "free-form"?

Thanks.

like image 733
Mahesh Avatar asked Dec 30 '10 21:12

Mahesh


1 Answers

A statically-typed language is a language where every variable has a type assigned to it at compile-time. In C++, this means that you must tell the compiler the type of each variable - that is, whether it's an int, or a double, or a string, etc. This contrasts with dynamically-typed languages like JavaScript or PHP, where each variable can hold any type, and that type can change at runtime.

A free-form language is one where there are no requirements about where various symbols have to go with regard to one another. You can add as much whitespace as you'd like (or leave out any whitespace that you don't like). You don't need to start statements on a new line, and can put the braces around code blocks anywhere you'd like. This has led to a few holy wars about The Right Way To Write C++, but I actually like the freedom it gives you.

Hope this helps!

like image 169
templatetypedef Avatar answered Sep 21 '22 10:09

templatetypedef