[lkml]   [2003]   [Feb]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] add new DMA_ADDR_T_SIZE define
Hi there,

On Wed, Feb 19, 2003 at 04:48:17PM -0500, Jeff Garzik wrote:
> /me wishes gcc would let the user application define printf formats
> for arbitrary [non-struct] user data types...

Better might be to change the whole protocol over to sth. like
that what PASCAL does but still print into a string. GCC is
type checking and enumerating the arguments for printf and scanf
anyway so it could also supply that information to the functions
itself, if they have a special attribute (__new_style_printf__).

If GCC needs to print/scan a type, it composes a function name
similiar to C++ signatures and calls this. If it does not exists,
it warns at compile time. The decomposition of constant strings
is done at compile time. There is also a GCC function, which does
it at runtime. This is no problem, since index into type name
table and number of arguments is on the stack along with the
varargs. So we only need to specify the numeric format like
hex/numeric, leading zero fill or not, space fill and so on. No
more fiddling with word sizes and signedness.

Even structures may be printed/assigned, by defining a start_level,
next_item and end_level function to print the equivalent of '{'
',' and '}' in the structure.

I would really vote for such an extension to GCC, since doing
this without the help of GCC is error prone (because it's not
really typesafe) and leads to many problems.

That way even the config file parsers get much simpler, because
you can define the lexical rules with scanf already today and now
you can even define a simple grammar likewise ;-)

But this is not the right list for this, but I just wanted to
braindump that ;-)


Ingo Oeser
Science is what we can tell a computer. Art is everything else. --- D.E.Knuth
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:33    [W:0.044 / U:0.560 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site