httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@algroup.co.uk>
Subject Re: [PATCH] Start of command handlers patch
Date Mon, 12 Jun 2000 19:47:04 GMT
dean gaudet wrote:
> 
> On Mon, 12 Jun 2000, Ben Laurie wrote:
> 
> > Cool - didn't know about this! Are you sure?
> 
> yup, just did a little test:
> 
>     % cat t.c
>     struct {
>             int a;
>             union {
>                     void *p;
>                     int b;
>             } u;
>             int c;
>     } foo = {
>             1, { [].b = 2 }, 3
>     };
>     % cat t.s
>             .file   "t.c"
>             .version        "01.01"
>     gcc2_compiled.:
>     .globl foo
>     .data
>             .align 4
>             .type    foo,@object
>             .size    foo,12
>     foo:
>             .long 1
>             .zero   4
>             .long 3
>             .ident  "GCC: (GNU) egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)"
> 
> 
> there's a gcc syntax for this and a c9x syntax, i'm pretty sure the above
> is the c9x syntax (istr digging out the standard to verify it before i
> started using it in my own code).

Cool.

> now only if c9x had overloaded function prototypes :)

+1!

> speaking of which -- if you wanted to do another gcc-ism you could try
> this:
> 
>     % cat t.c
>     #include <string.h>
> 
>     #define ap_strchr(s, c)  ((typeof(s))(strchr(s, c)))
> 
>     const char *a(const char *s, int c)
>     {
>             return ap_strchr(s, c);
>     }
> 
>     char *b(char *s, int c)
>     {
>             return ap_strchr(s, c);
>     }
> 
>     char *c(const char *s, int c)
>     {
>             return ap_strchr(s, c);
>     }
>     % gcc -Wall -c t.c
>     t.c: In function `c':
>     t.c:17: warning: return discards `const' from pointer target type
> 
> am i making you sick yet?  :)

Nah! This is cool - I get C++ features that Dean approves of! And
there's less code. And we get the native functions in all cases!

Am _I_ making _you_ sick yet? :-)

Cheers,

Ben.

--
http://www.apache-ssl.org/ben.html

Coming to ApacheCon Europe 2000? http://apachecon.com/

Mime
View raw message