Forums

horrible C indexing

Started by Grant Griffin April 1, 2006
"robert bristow-johnson" <rbj@audioimagination.com> wrote in 
message 
news:1144041555.371128.119790@z34g2000cwc.googlegroups.com...
> > Andrew Reilly wrote: >> >> double buf[10]; >> base1_routine(buf - 1); /* or base1_routine(&buf[-1]); >> equivalent */ >> > > so, Andrew, are they saying that buf-1 is not guaranteed > to be an > address that you could form a pointer with and index off > of? >
I wonder what would happen to (buf-1)+1 in a weird environment like the overlapped, segmented memory model of the 8086/80286 if buf were mapped to the zero-th address in a segment.
> double buf[10]; > base1_routine(buf - 1) > > void base1_routine(double *a) > { > int i; > for (i = 1; i <= 10; i++) > { > a++; > *a = foo(i, a); > } > }
C doesn't assume a flat addressing model for physical memory. In fact, it doesn't assume much of anything about the physical machine. In order to make the above code fragment work, 'a' would have to be maintained as a pointer to a flat address space and the compiler would have to emit a bunch of code to convert the pointer into a segmented address. To be sure, some C compilers offered this as an option (sometimes called the "Large Model"), but the user paid a heavy price in performance for using it.
robert bristow-johnson wrote:
> :-) > > (hey guyz, pleeeze crosspost these to c.s-s.m. otherwize it's just our > private pleasure.)
Naw, r, if there's one thing I learned from the original thread years ago, it's that Clive and the devoted Matminions he's fleeced ain't got no sense of humor. ;-) =g2 _____________________________________________________________________ Grant R. Griffin Publisher of dspGuru http://www.dspguru.com Iowegian International Corporation http://www.iowegian.com See http://www.iowegian.com/img/contact.gif for e-mail address
Grant Griffin wrote:
> robert bristow-johnson wrote: > > :-) > > > > (hey guyz, pleeeze crosspost these to c.s-s.m . otherwize it's just our > > private pleasure.) > > Naw, r, if there's one thing I learned from the original thread years > ago, it's that Clive and the devoted Matminions he's fleeced ain't got > no sense of humor. ;-)
perhaps or not. i might expect *Cleve* (with two e's) to take it more humorously if we at least refrain from misspelling his first name. Cleve, i got over a half decade ago hoping to positively influence you about this. i hope you got at least a little self-depricating kick out of Grant's and Al's pokes. it's good for all of us. r b-j
"robert bristow-johnson" <rbj@audioimagination.com> wrote in 
news:1144081152.417034.11310@e56g2000cwe.googlegroups.com:

> Cleve, i got over a half decade ago hoping to positively influence you > about this. i hope you got at least a little > ***self-depricating*** (emphasis added) kick out > of Grant's and Al's pokes. it's good for all of us. >
I should have known that a bunch of guys who can't understand a ones-based index system would spell phonetically. Were you overwhelmed when Crayola made the jump to 96-color boxes? -- Scott Reverse name to reply
Scott Seidman <namdiesttocs@mindspring.com> wrote in
news:Xns979A7FA382803scottseidmanmindspri@130.133.1.4: 

> "robert bristow-johnson" <rbj@audioimagination.com> wrote in > news:1144081152.417034.11310@e56g2000cwe.googlegroups.com: > >> Cleve, i got over a half decade ago hoping to positively influence >> you about this. i hope you got at least a little >> ***self-depricating*** (emphasis added) kick out >> of Grant's and Al's pokes. it's good for all of us. >> > > > I should have known that a bunch of guys who can't understand a > ones-based index system would spell phonetically. Were you > overwhelmed when Crayola made the jump to 96-color boxes? > >
I hate misspelling peoples names. I apologize. Since I can't spell, I guess it must prove that I really have an enigneering education. -- Al Clark Danville Signal Processing, Inc. -------------------------------------------------------------------- Purveyors of Fine DSP Hardware and other Cool Stuff Available at http://www.danvillesignal.com
Al Clark <dsp@danvillesignal.com> wrote in
news:Xns979A7C2CA8D8Eaclarkdanvillesignal@66.133.129.71: 

> Scott Seidman <namdiesttocs@mindspring.com> wrote in > news:Xns979A7FA382803scottseidmanmindspri@130.133.1.4: > >> "robert bristow-johnson" <rbj@audioimagination.com> wrote in >> news:1144081152.417034.11310@e56g2000cwe.googlegroups.com: >> >>> Cleve, i got over a half decade ago hoping to positively influence >>> you about this. i hope you got at least a little >>> ***self-depricating*** (emphasis added) kick out >>> of Grant's and Al's pokes. it's good for all of us. >>> >> >> >> I should have known that a bunch of guys who can't understand a >> ones-based index system would spell phonetically. Were you >> overwhelmed when Crayola made the jump to 96-color boxes? >> >> > > I hate misspelling peoples names. I apologize. Since I can't spell, I > guess it must prove that I really have an enigneering education. >
I was talking about "depricating", actually, and found the misspelling in the post correcting a misspelling to be somewhat funny. I took the opportunity to see if we can all enjoy the self-deprecating kick. -- Scott Reverse name to reply
Scott Seidman wrote:
> Al Clark <dsp@danvillesignal.com> wrote in > news:Xns979A7C2CA8D8Eaclarkdanvillesignal@66.133.129.71: > > > Scott Seidman <namdiesttocs@mindspring.com> wrote in > > news:Xns979A7FA382803scottseidmanmindspri@130.133.1.4: > > > >> "robert bristow-johnson" <rbj@audioimagination.com> wrote in > >> news:1144081152.417034.11310@e56g2000cwe.googlegroups.com: > >> > >>> Cleve, i got over a half decade ago hoping to positively influence > >>> you about this. i hope you got at least a little > >>> ***self-depricating*** (emphasis added) kick out > >>> of Grant's and Al's pokes. it's good for all of us. > >>> > >> > >> > >> I should have known that a bunch of guys who can't understand a > >> ones-based index system would spell phonetically. Were you > >> overwhelmed when Crayola made the jump to 96-color boxes? > >> > >> > > > > I hate misspelling peoples names. I apologize. Since I can't spell, I > > guess it must prove that I really have an enigneering education. > > > > I was talking about "depricating", actually, and found the misspelling in > the post correcting a misspelling to be somewhat funny. > > I took the opportunity to see if we can all enjoy the self-deprecating > kick.
i'm happy with it. after winning the MATLAB indexing base issue, we'll take on the written english language to make it phonetic. maybe get Bill Gates involoved (we'll add "depricating" to the spell check dictionary and then get it added to Webster a la the Dilbert cartoon). "use to be i cudn't even spel enjinear, now i are one." r b-j
robert bristow-johnson wrote:
> ... after winning the MATLAB indexing base issue...
Cool - what did you win?
spasmous wrote:
> robert bristow-johnson wrote: > > ... after winning the MATLAB indexing base issue... > > Cool - what did you win?
well, we haven't won *yet*, but since truth and justice is on our side and since truth and justice always wins (eventually), well then, it's just a matter of time. and when that time comes, we'll take on bigger foes. r b-j
robert bristow-johnson wrote:
> Grant Griffin wrote: >> robert bristow-johnson wrote: >>> :-) >>> >>> (hey guyz, pleeeze crosspost these to c.s-s.m . otherwize it's just our >>> private pleasure.) >> Naw, r, if there's one thing I learned from the original thread years >> ago, it's that Clive and the devoted Matminions he's fleeced ain't got >> no sense of humor. ;-) > > perhaps or not. i might expect *Cleve* (with two e's) to take it more > humorously if we at least refrain from misspelling his first name.
Actually, I had thought that Al's fine molarpropism could only add to the humor--especially on April 0th. So I perpetuated it, not realizing that it could cause any toothaches. ;-) =g2 _____________________________________________________________________ Grant R. Griffin Publisher of dspGuru http://www.dspguru.com Iowegian International Corporation http://www.iowegian.com See http://www.iowegian.com/img/contact.gif for e-mail address