Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Who invented the zero based
Message
 
To
24/11/2011 09:04:26
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01529748
Message ID:
01529856
Views:
62
>I've been thinking about this this morning. Who invented the zero based approach, which applies to a lot of things in several development environments, including, among others, .NET. This is always a waste of time trying to understand/find which one applies to a specific component. I mean, when I start counting, I start at 1, right? lol

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.

+++ Rick ---
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform