lua-users home
lua-l archive

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


On Wed, Oct 04, 2006 at 05:51:36PM -0400, Glenn Maynard wrote:
> On Wed, Oct 04, 2006 at 02:31:49PM -0700, Sam Roberts wrote:
> > Try without -pedantic. The only purpose of -pedantic is to make some
> > code NOT compile, and you want lposix.c to compile.
> 
> The gcc documentation claims -pedantic only adds warnings, not errors.
> I guess the glibc folks are detecting the switch, and using it for
> things it wasn't meant for?

I have no idea if/when it became useful :-), it wasn't originally meant
to be:

  This option is not intended to be useful; it exists only to satisfy
  pedants who would otherwise claim that GCC fails to support the ANSI
  standard.

  - http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_2.html#SEC8

> If your goal is to compile it and put it on a shelf, maybe you just want
> to compile it; but I think most people compiling it want to use it, so
> it's useful, not arcane, for it to actually work properly.  :)

Fair enough. On your system, does the attached code print different
values for CLK_TCK and sysconf(_SC_CLK_TCK)?

On my system:

% grep CLK_TCK /usr/include/bits/time.h
#   define CLK_TCK ((__clock_t) __sysconf (2))  /* 2 is _SC_CLK_TCK */

CLK_TCK has been around a while, I don't think linux is going to break
all that old software even if it isn't pedantically correct.

Cheers,
Sam

#include <stdio.h>
#include <time.h>
#include <unistd.h>

int main()
{
	printf("CLK_TCK %lu\n", CLK_TCK);
	printf("CLOCKS_PER_SEC %lu\n", CLOCKS_PER_SEC);
	printf("_SC_CLK_TCK %ld\n", sysconf(_SC_CLK_TCK));
	return 0;
}