Click here to Skip to main content
15,891,833 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: [Solved] Why Do Computer Counts from Zero. Pin
PIEBALDconsult24-Apr-13 11:58
mvePIEBALDconsult24-Apr-13 11:58 
GeneralRe: [Solved] Why Do Computer Counts from Zero. Pin
Clifford Nelson24-Apr-13 12:48
Clifford Nelson24-Apr-13 12:48 
GeneralRe: [Solved] Why Do Computer Counts from Zero. Pin
PIEBALDconsult24-Apr-13 16:00
mvePIEBALDconsult24-Apr-13 16:00 
JokeRe: [Solved] Why Do Computer Counts from Zero. Pin
Keith Barrow23-Apr-13 0:37
professionalKeith Barrow23-Apr-13 0:37 
GeneralRe: [Solved] Why Do Computer Counts from Zero. Pin
kburman623-Apr-13 5:05
professionalkburman623-Apr-13 5:05 
GeneralRe: [Solved] Why Do Computer Counts from Zero. Pin
jsc4223-Apr-13 22:59
professionaljsc4223-Apr-13 22:59 
GeneralRe: [Solved] Why Do Computer Counts from Zero. Pin
svella24-Apr-13 3:58
svella24-Apr-13 3:58 
GeneralRe: [Solved] Why Do Computer Counts from Zero. Pin
jsc4224-Apr-13 4:37
professionaljsc4224-Apr-13 4:37 
You are correct! What I meant (and I admit that the language that I used was far from rigorous) was that the relative offset is unvarying. If, for example, the offset of the start of the memory allocated for the array is 100 from a location (relative addressing / stack frame relative / absolute / whatever) and each element takes up 4 address locations (e.g. bytes), then all that the compiler does for 1-based indices is to use 96 + n * 4 (because 100 - 4 = 96) instead of 100 +(n - 1) * 4 in all of its address calculations for the array; this is as simple as using 100 + n * 4 for 0-based indices. This can be extended for arrays with specifiable lower bounds e.g. in this example if lwb is the lower bound, the 0-based index offset would be 100 + (n - lwb) * 4 [or more optimally (100 - lwb * 4) + n * 4] or for 1-based index offset would be (100 - (lwb + 1) * 4) + n * 4 = (96 - lwb * 4) + n * 4.
GeneralRe: [Solved] Why Do Computer Counts from Zero. Pin
svella24-Apr-13 6:09
svella24-Apr-13 6:09 
GeneralRe: [Solved] Why Do Computer Counts from Zero. Pin
DarthDana24-Apr-13 5:28
professionalDarthDana24-Apr-13 5:28 
GeneralRe: [Solved] Why Do Computer Counts from Zero. Pin
KP Lee24-Apr-13 20:45
KP Lee24-Apr-13 20:45 
GeneralMessage Closed Pin
20-Apr-13 5:39
Member 1000120220-Apr-13 5:39 
GeneralRe: waht is this code means in web programming t=login%3CScript%20%3Ealert(%22HelloSIG%22)%3C/Script%3E t=%3CScript+%3Ealert%28%22HelloSIG%22%29%3C%2FScript%3E] d=hTNonAxS6pSg7xdyL1eUirZ8bPjtkz-rbl6VNlqYedqYrHs_bDcid9Hlixt8Y2moR5bKlpB-ULt3A_ Pin
R. Giskard Reventlov20-Apr-13 5:47
R. Giskard Reventlov20-Apr-13 5:47 
GeneralRe: waht is this code means in web programming t=login%3CScript%20%3Ealert(%22HelloSIG%22)%3C/Script%3E t=%3CScript+%3Ealert%28%22HelloSIG%22%29%3C%2FScript%3E] d=hTNonAxS6pSg7xdyL1eUirZ8bPjtkz-rbl6VNlqYedqYrHs_bDcid9Hlixt8Y2moR5bKlpB-ULt3A_ Pin
RedDk20-Apr-13 8:27
RedDk20-Apr-13 8:27 
GeneralRe: waht is this code means in web programming t=login%3CScript%20%3Ealert(%22HelloSIG%22)%3C/Script%3E t=%3CScript+%3Ealert%28%22HelloSIG%22%29%3C%2FScript%3E] d=hTNonAxS6pSg7xdyL1eUirZ8bPjtkz-rbl6VNlqYedqYrHs_bDcid9Hlixt8Y2moR5bKlpB-ULt3A_ Pin
PIEBALDconsult20-Apr-13 18:06
mvePIEBALDconsult20-Apr-13 18:06 
GeneralMessage Closed Pin
20-Apr-13 4:52
Member 1000120220-Apr-13 4:52 
GeneralRe: Can anyone help me identify the strange condes that I have in my webserver log files( asp.net application) and what to do to protect my data Pin
PIEBALDconsult20-Apr-13 5:05
mvePIEBALDconsult20-Apr-13 5:05 
GeneralRe: Can anyone help me identify the strange condes that I have in my webserver log files( asp.net application) and what to do to protect my data Pin
Member 1000120220-Apr-13 5:21
Member 1000120220-Apr-13 5:21 
GeneralRe: Can anyone help me identify the strange condes that I have in my webserver log files( asp.net application) and what to do to protect my data Pin
Thomas Daniels21-Apr-13 3:32
mentorThomas Daniels21-Apr-13 3:32 
RantYet another Subversion rant Pin
jim lahey19-Apr-13 5:00
jim lahey19-Apr-13 5:00 
GeneralRe: Yet another Subversion rant Pin
ZurdoDev19-Apr-13 5:24
professionalZurdoDev19-Apr-13 5:24 
GeneralRe: Yet another Subversion rant Pin
QuiJohn19-Apr-13 5:34
QuiJohn19-Apr-13 5:34 
GeneralRe: Yet another Subversion rant Pin
ZurdoDev19-Apr-13 5:39
professionalZurdoDev19-Apr-13 5:39 
GeneralRe: Yet another Subversion rant Pin
James Lonero25-Apr-13 8:01
James Lonero25-Apr-13 8:01 
GeneralRe: Yet another Subversion rant Pin
QuiJohn26-Apr-13 2:33
QuiJohn26-Apr-13 2:33 

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.