Click here to Skip to main content
15,897,518 members

Survey Results

Random style question: Which variable declaration do you prefer?

Survey period: 22 Jul 2019 to 29 Jul 2019

Strict formalism or fast and loose? Typesafe or no type at all? For anyone who switches languages often this can get messy.

OptionVotes% 
int count (Standard C-style)76666.78
count: Integer (eg Pascal)342.96
var count: int, or val count: Integer (eg TypeScript)201.74
var count int (eg Go)191.66
Declare @count int (eg SQL)161.39
Dim Count As Integer (eg VB)786.80
Count = 1 or $count = 1 (eg Python or PHP)282.44
(defvar count 1) (eg LISP, and similar in Scheme)20.17
Other272.35
I'm not fussed. Whatever works.15713.69



 
GeneralOf course the C++ moh-dern-ist Pin
Dean Roddey28-Jul-19 2:49
Dean Roddey28-Jul-19 2:49 
Generalnot picky Pin
Matt McGuire24-Jul-19 5:20
professionalMatt McGuire24-Jul-19 5:20 
GeneralThe result indirectly tells that people are more comfortable in C/C# type language Pin
Anurag Gandhi23-Jul-19 7:01
professionalAnurag Gandhi23-Jul-19 7:01 
GeneralCan we give anything to old BASIC? Pin
bryanren23-Jul-19 6:08
bryanren23-Jul-19 6:08 
GeneralRe: Can we give anything to old BASIC? Pin
OriginalGriff24-Jul-19 10:07
mveOriginalGriff24-Jul-19 10:07 
GeneralRe: Can we give anything to old BASIC? Pin
bryanren24-Jul-19 13:38
bryanren24-Jul-19 13:38 
GeneralRe: Can we give anything to old BASIC? Pin
OriginalGriff24-Jul-19 19:09
mveOriginalGriff24-Jul-19 19:09 
Generalwhy was C# left out ? Pin
BillWoodruff23-Jul-19 4:16
professionalBillWoodruff23-Jul-19 4:16 
GeneralAny option with strict typing Pin
obermd23-Jul-19 3:20
obermd23-Jul-19 3:20 
GeneralAnother Missing Option Pin
Slow Eddie23-Jul-19 3:20
professionalSlow Eddie23-Jul-19 3:20 
GeneralRe: Another Missing Option Pin
Chris Maunder23-Jul-19 3:41
cofounderChris Maunder23-Jul-19 3:41 
GeneralRe: Another Missing Option Pin
Kirk 1038982123-Jul-19 4:20
Kirk 1038982123-Jul-19 4:20 
GeneralRe: Another Missing Option Pin
Slow Eddie23-Jul-19 5:59
professionalSlow Eddie23-Jul-19 5:59 
GeneralRe: Another Missing Option Pin
raddevus24-Jul-19 7:58
mvaraddevus24-Jul-19 7:58 
GeneralI'm not fussed Pin
MarkTJohnson23-Jul-19 2:52
professionalMarkTJohnson23-Jul-19 2:52 
GeneralRe: I'm not fussed Pin
raddevus24-Jul-19 7:52
mvaraddevus24-Jul-19 7:52 
GeneralMissing option Pin
Gary Wheeler23-Jul-19 1:34
Gary Wheeler23-Jul-19 1:34 
GeneralLife is no longer so simple Pin
Marc Clifton22-Jul-19 7:53
mvaMarc Clifton22-Jul-19 7:53 
GeneralRe: Life is no longer so simple Pin
Slacker00722-Jul-19 10:25
professionalSlacker00722-Jul-19 10:25 
GeneralYou missed C# inferred style. Pin
nmarcel22-Jul-19 3:10
nmarcel22-Jul-19 3:10 
GeneralRe: You missed C# inferred style. PinPopular
PeejayAdams22-Jul-19 4:42
PeejayAdams22-Jul-19 4:42 
nmarcel wrote:
var number = 0;


The type inferred there is specifically a 32 bit signed integer.

If we intended "number" to be an Int64 for example, we'd have to either default it to a value that's too large for a 32 bit int and reset it to 0 or just take the simple route and declare it explicitly as an Int64.

What is the actual benefit of "var" here? "int number = 0;" is both more readable (we can see what type of int it is without resorting to tool-tips) and we're explicitly telling the compiler what to do rather than hoping it infers our intended type.
Whenever you find yourself on the side of the majority, it is time to pause and reflect. - Mark Twain

GeneralRe: You missed C# inferred style. Pin
Scott Serl22-Jul-19 9:21
Scott Serl22-Jul-19 9:21 
GeneralRe: You missed C# inferred style. Pin
OriginalGriff22-Jul-19 9:29
mveOriginalGriff22-Jul-19 9:29 
GeneralRe: You missed C# inferred style. Pin
Slacker00722-Jul-19 10:24
professionalSlacker00722-Jul-19 10:24 
GeneralRe: You missed C# inferred style. (C# is essenially C++ as far as BNF concerned) Pin
steveb27-Jul-19 3:41
mvesteveb27-Jul-19 3:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.