Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Arrays and pointers in GCC

2009-01-12 by David VanHorn

> Hi Dave, first it's not a pointer you are using in your code... It's an
> index into the array. A pointer is an address of something, like you'd
> use xh:xl for in asm. You need 16 bits for a pointer as it can address
> the whole of the memory.

Sorry, said pointer, meant index..


> You should be able to use a char as the index into your array, how are
> you defining it and what happens?

I get warnings from the compiler
I really dislike warnings.
The warning tells me that I'm using a char, which of course I already know..
Is there something bad/wrong/inappropriate in using an unsigned char this way?
I could see problems with using a SIGNED char.. That could be entertaining.
(and a fun way to obsfucate code...)

> I share your pain when you look at what the compiler's done, compared to
> how you can do it in asm. You just have to breathe deeply and let it go.
> If you're really strapped for execution time, you can write bits of it
> in asm.

And they told me and told me that C is can generate code that's "just
as good" as a human..
I thought they meant some non-random human...

:)

> Don't even think about trying to use part of a byte as a variable and
> part for flags. You can do it, but it starts to negate all the reasons
> for writing in C in the first place.

Why?

I might be using the wrong terms here, but it seems to me like just
another sort of struct.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.