473,324 Members | 2,531 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

colons

I do not usually use the colon in my code however sometimes i find it usefull
e.g.

pulling data from an array

....
i += 1 : this = stuff(i)
i += 1 : that = stuff(i)
i += 1 : theOther = stuff(i)
....

as it reads more clearly than incrementing i on a separate line.
Is this considered bad practice?

guy
Nov 20 '07 #1
2 1240
"guy" <gu*@discussions.microsoft.comschrieb
I do not usually use the colon in my code however sometimes i find
it usefull e.g.

pulling data from an array

...
i += 1 : this = stuff(i)
i += 1 : that = stuff(i)
i += 1 : theOther = stuff(i)
...

as it reads more clearly than incrementing i on a separate line.
Is this considered bad practice?
I did it many years ago, then considered it bad practice for many years, now
I start considering it a legitimate way (in some cases like your example)

So: A matter of taste.
Armin

Nov 20 '07 #2
guy wrote:
I do not usually use the colon in my code
.... likewise ...
however sometimes i find it useful, e.g. pulling data from an array
...
i += 1 : this = stuff(i)
i += 1 : that = stuff(i)
i += 1 : theOther = stuff(i)
...
Personally, unless both of these arrays are dynamic and the index ranges
all over the place, I'd just /hard-code/ the offsets:

Const XOffset as Integer = 0
Const YOffset as Integer = 1
Const ZOffset as Integer = 2

this = stuff( i + XOffset )
that = stuff( i + YOffset )
theOther = stuff( i + ZOffset )
as it reads more clearly than incrementing i on a separate line.
Agreed.
Is this considered bad practice?
It certainly /used/ to be (I'm thinking VB6 here) because it was darned
difficult to put breakpoints on the second and subsequent statements on
a given line.
I don't think it's a problem any more, so whatever works for you...

HTH,
Phill W.

>
guy
Nov 20 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Charon | last post by:
I see two colons in the middle of what look like method calls here and there. Such as when using PEAR // implement pear db object $this->_oConn =& DB::connect(DSN); I have looked all over...
0
by: Sybil Wiley | last post by:
--___.1FF6...1 Content-Type: text/html; Content-Transfer-Encoding: quoted-printable <html> <body> <div align=3D"center"> <center> <table border=3D"0" cellspacing=3D"1" width=3D"100%"> <tr>
0
by: Shelly Keith | last post by:
--61068_1D2_31 Content-Type: text/html; Content-Transfer-Encoding: quoted-printable <html> <body> <div align=3D"center"> <center> <table border=3D"0" cellspacing=3D"1" width=3D"100%"> <tr>
15
by: Steven Livingstone | last post by:
I am running into the "colon in javascript" problem as discussed here http://www.bdragon.com/entries/000324.shtml. Basically, i have nested controls and get the error on a line such as : ...
9
by: Jeremy | last post by:
I apologize if this is the wrong group, but my usenet provider doesn't carry any CSS-specific groups, and people in this group are likely to be CSS experts anyhow. My question is this: In HTML,...
2
by: Paddy | last post by:
i was just perusing a Wikipedia entry on the "off side rule" at http://en.wikipedia.org/wiki/Off-side_rule . It says that the colon in Python is purely for readability, and cites our FAQ entry...
9
by: Paddy | last post by:
I was just perusing a Wikipedia entry on the "off side rule" at http://en.wikipedia.org/wiki/Off-side_rule . It says that the colon in Python is purely for readability, and cites our FAQ entry...
6
by: Grant Robertson | last post by:
I am relatively new to XML, though I have taught myself a lot in the past month. I keep seeing namespace names with multiple colons in them such as: "urn:oasis:names:tc:entity:xmlns:xml:catalog"...
26
by: machineghost | last post by:
First off, let me just say that as someone with no DBA training whatsoever, any help I can get with this issue will be very, very much appreciated. My company recently migrated our database from...
0
by: Frank Swarbrick | last post by:
>>On 6/27/2008 at 7:00 PM, in message <fe715a94-6138-4934-9ff7-aa4e4d2f5e7e@c19g2000prf.googlegroups.com>, machineghost<machineghost@gmail.comwrote: Not to be offensive, but...did you try it? ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.