You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jim Jagielski <ji...@jaguNET.com> on 1997/06/14 00:25:04 UTC

Pointer or Int... Which is bigger

Here's a quick and dirty way of generating a header file that
includes the correct typedef:

    #include <stdio.h>
    #define HEADER "./ptrint.h"
    main() {
       FILE *fp;
       unlink(HEADER);
       fp = fopen(HEADER, "w");
       if (sizeof(void*) > sizeof(int)) {
	   fprintf(fp, "typedef ptr_int void*;\n");
       } else {
	   fprintf(fp, "typedef ptr_int int;\n");
       }
    }

Note it's not error correcting at all... The files would include
ptrint.h and then cast as needed. This would be built first in
Makefile, which would also run it and then the build could continue
as needed (or done via Configure and keep Makefile clean)...

'Course, Configure will become much more intelligent as time goes
on so it may be best to put it there.
-- 
====================================================================
      Jim Jagielski            |       jaguNET Access Services
     jim@jaguNET.com           |       http://www.jaguNET.com/
            "Look at me! I'm wearing a cardboard belt!"