On Mon, Jun 1, 2009 at 4:35 AM, Zach Welch <[email protected]> wrote:
> On Mon, 2009-06-01 at 04:15 +0200, Michael Bruck wrote:
>> The 'struct foo_s' syntax is code bloat that obscures the actual
>> algorithms. 'foo_t' is shorter.
>
> I assume you prefer u32 over uint32_t, then? ;) Nevermind....
Yes I do.
> I think 'struct foo' is much more clear when reading and writing code.
>
>> Doxygen seems to recognize the foo_s and foo_t version as one an the
>> same, I don't see what problem you have there. However it will just as
>> happily accept foo_t only, like in
>>
>> typedef struct {} foo_t;
>
> The problem with the documentation is the fact that there are two types
> that refer to the same thing. The current scheme imposes extra effort
> for new developers to realize that many blah_t types are structures, and
> there is not immediate way to tell them apart without digging into
> further into the documentation or code.
>
> I think the Wikipedia page on typedefs does a good job of explaining the
> reasons to avoid them in this particular case:
>
> http://en.wikipedia.org/wiki/Typedef
>
> Neither of the K&R guidelines for using typedefs are met in this case:
> 1) These types do nothing to aid portability; they add no value here.
> 2) These types do not make a complex declaration easier to understand.
> If anything, they make a simple declaration unnecessarily opaque.
Thanks, I know the purpose of typedef. In this particular case it is a
widely-used way to simulate the C++ behavior where the struct keyword
is unnecessary.
If it was for me the foo_s version would not exist, and there would be
no duplication.
You are pulling out K&R? You can't be serious!
Michael
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development