[A89] Re: c trouble


[Prev][Next][Index][Thread]

[A89] Re: c trouble



Mike McElroy wrote:

> "Dynamic anything" can be dangerous because you might, if you're not 
> careful, end up with your variables overwriting each other. Like I said.

Then you are a bad programmer...
If you want to program efficient complex programs you can't waste 
resources just because you can't handle pointers correctly.

> Did you really read what I said? You just combined my two examples 
> into one... char foo[3][3] and char **foo weren't supposed to be the 
> same thing. I never said they were. I said that you can use char **foo 
> as an array. You simply don't have the assurance that your data is 
> intact as you would with char foo[3][3].

You have no assurence that a char foo[3][3] is intact.
Just as well as you can screw up a pointer so it points to something a 
char** points to, you can screw up a pointer so it points into your char 
foo[3][3];
They are all in the same memory, and not even real OS:s prevents a 
program from changing any of its own data segment or the stack. (where 
the foo[3][3] will be).
Sure, it can be a bit more tricky to use the first but that can't stop 
you if you want to be a _good_ programmer.
And ofcourse again, if you always only want a fixed size array, for a 
matrix for example, THEN you ofcourse should use a char foo[3][3]; But 
having a varied size map for example in a fixed array is just stupid 
unless the difference in sizes is very small.

>  Looking at your TICalc author profile, I notice you said you program 
> for ASM and have authored no programs. I, on the other hand, program 
> for ASM, C, and BASIC, and have authored 60 programs. Perhaps you 
> should take this into account before you say I "obviously know nothing 
> about C and arrays and pointers." I especially urge you to look at the 
> source code to my BASIC-accessible C library, MLib. Might change your 
> mind.
>  

No, I havn't uploaded anything to ticalc.org. I have released a few asm 
files and has contributed with general advice on this and asm83 list for 
some years. I think my help has been mostly appreciated. (At least I get 
thanked for it here and there) Oh. the asmguru (ti83) helpfile has some 
code of mine in it :) nothing much, but matthew asked my for some 
example code. I also run www.ti89hardware.com. It hasn't been updateded 
lately though, since I havn't been active at all with the calcs in 
several years now (was I ever really active?)
There, a short presentation :)
I'm sorry I was rude, I had a bad day, but I shouldn't have let it out 
on the list.
You have all right to feel offended.
But you were terribly wrong, really :)

Hopes to avoid a flame war :)
--Olle





References: