News for hackers. Stuff that matters.
Re:The byte order fallacy by masklinn on Wednesday April 04, 2012 @03:02AM (#3796500)
> or another template language

Surely this could be handled via simple syntactic extensions to the struct specification (with everything wrapped into an ungodly macro from hell) in order to define the mapping between the struct itself and libpack's format string, no?

Re:The byte order fallacy by ge0rg on Wednesday April 04, 2012 @03:16AM (#3796529)
The problem is that you need to replicate the struct entries in the pack/unpack calls as well, which is only possible in plain C by using X-Macros.

It might be possible to construct a macro that creates both the struct and the format string, though.

Re:The byte order fallacy by masklinn on Wednesday April 04, 2012 @04:03AM (#3796630)
> The problem is that you need to replicate the struct entries in the pack/unpack calls as well

Don't you only need the (generated) format string? Ideally, the macro could generate some wrapper function of some sort as well, which would unpack, fill and return an instance of the struct.