Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Who invented the zero based
Message
De
26/11/2011 18:00:43
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01529748
Message ID:
01529858
Vues:
46
>We have C and Assembly language to thank for that. Arrays/indexes are based on pointers moving through a list typically and pointer offsets always start at 0. It's convention and it makes goods sense since that's how computers work.
>
>Now obviously high level languages like C# or JavaScript have no requirements for that since they don't really use pointers at the language level but all C style languages (C, C++, Java, JavaScript, C# etc.) have always used 0 based offsets and it would be weird to use C-style languages with 1 based offsets. It would destroy the whole continuity and familiarity with the syntax.
>
>All that said, if you're using .NET and C# use something like CodeRush or ReSharper which will auto fill for structures for you so you never really have to think about it. Additionally in C# it's not that frequent that you use for x loops - most operations in .NET involve foreach() iteration with enumerators which are much cleaner syntactly and removing the need to know anything about array indexes at all.

Thanks, yes, I have a lot of For/Each, but also have the For/Next support at various locations. As you said, the first one doesn't require a pointer while the next one does.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform