tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [PATCH] style(5): No struct typedefs



On 2023-07-11 15:28, Mouse wrote:
I don't get it.  Why the "void *" stuff?  That is where I think the
real badness lies, and I agree we should not have that.

But defining something like

typedef struct bus_dma_tag *bus_dma_tag_t;

would mean we could easily change what bus_dma_tag_t actually is,
keeping it opaque, while at the same time keeping the type checking.

Um, no, you get the type checking only as long as "what [it] actually
is" is a tagged type - a struct, union, or (I think; I'd have to check)
enum.  Make it (for example) a char *, or an unsigned int, and you lose
much of the typechecking.

Maybe I missed your point. Yes, if you typedef something based on some simple type like int, that it's no different than any other int.

typedefs in C don't really create new types. They are all just derivatives. Sometimes I even wonder why typedef exists in C. Feels like I could accomplish the same with a #define

  Johnny

--
Johnny Billquist                  || "I'm on a bus
                                  ||  on a psychedelic trip
email: bqt%softjar.se@localhost             ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol


Home | Main Index | Thread Index | Old Index