[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-recutils] Re: recutils 1.1 and portability
From: |
Bruno Haible |
Subject: |
[bug-recutils] Re: recutils 1.1 and portability |
Date: |
Sun, 19 Dec 2010 19:44:28 +0100 |
User-agent: |
KMail/1.9.9 |
Hello José,
> 1.1) Portability problems of printf statements on platforms where
> 'size_t' is larger than 'unsigned int':
>
> Fixed in git. I used "%zu" in the asprintf calls.
Unfortunately, the module 'vasprintf' that you request (see m4/gnulib-cache.m4)
is not enough: The 'z' size modifier is not supported in asprintf() on
Cygwin 1.5.x and BeOS. You need the 'vasnprintf-posix' module instead.
The gnulib doc about this module was missing; I've added it now.
> 1.2) Maintainability problems: If you modify the definition of a function
> and forget to update some other source files, it will compile and BOOOM at
> runtime.
>
> I am thinking on the best way to fix this problem. The ideal solution
> would be to include declarations for the functions in a single header
> file that gets included by both rec-sex-lex.c (generated by lex) and
> rec-parser.c.
Yes, a common .h file, included by several .c files, this is the way this kind
of problem is generally avoided.
> The bison parser is including libintl.h only if
> ENABLE_NLS is defined. That should be safe enough, right?
Yes, this is safe. ENABLE_NLS is only defined to true if <libintl.h>
exists; see
<http://www.gnu.org/software/gettext/manual/html_node/AM_005fGNU_005fGETTEXT.html>
> 2.5) Test suite results:
>
> 5 of 6 tests failed
> ...
> It seems that the sh program
> in macosx is not recognizing the -n option to echo:
>
> echo -n "fail"
Yes, it is like this:
$ /bin/sh -c 'echo -n "fail"'
-n fail
Note that for 8 months now, we are considering the 'printf' command to be
sufficiently portable (see
<http://lists.gnu.org/archive/html/bug-gnulib/2010-04/msg00264.html>
<http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=c9f911dbdb52770946a6e93d283caa0583ade4a5>).
Therefore you don't need to fiddle with echo -n, if you can also use
printf %s. The only known drawback of printf %s is that it may be slower -
if 'echo' is a shell built-in and 'printf' is not.
Bruno