bug-gnulib
[Top][All Lists]
Advanced

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

Re: Compilation problem with base64.c


From: Micah Cowan
Subject: Re: Compilation problem with base64.c
Date: Tue, 30 Oct 2007 13:27:53 -0700
User-agent: Thunderbird 1.5.0.13 (X11/20070824)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Guy Rutenberg wrote:
> When trying to compile base64.c using g++ I got the following
> compilation problems:

Note that base64.c, .h are written in C, not C++. Trying to compile with
g++ makes almost as little sense as trying to compile it as Fortran.

The "restrict" keyword, as used, is entirely appropriate for C code, as
it is part of the C language. It is not part of the C++ language (at
least not yet).

It's a relatively recent addition to the C language, so the restrict
keyword is #defined to nothing for C compilers that don't support it
(doesn't apply to modern GCC, which has supported it for a while, but
_only_ when running as a C compiler). base64.c and .h expect that they
are being built using a configuration-and-build environment that makes
use of its autoconf macros and other dependencies that gnulib (mostly)
automatically sets up for it. The m4 code that comes with these files
invokes autoconf's AC_C_RESTRICT macro, which handles the case that the
restrict keyword isn't supported for your compilation environment.

In other words, what you're experiencing is not a bug with gnulib; it's
a problem with the way you're using the code. You _really_ should be (1)
using a C (not C++!) compiler, and (2) using the complete base64 gnulib
module (including automake code). It's _okay_ not to do either of those
two things, but note that it is not supported, and you are on your own
to fix the glitches that are almost certain to come up.

If you want to go ahead and continue doing it the way you're doing it,
you may wish to leave the "restrict" keywords as they appear in the
original source files, and pass -Drestrict= to g++, to make it easier
for you to grab updated versions of those source files (though, if you
do that, prepare to fix more "glitches", since, as previously mentioned,
this process is not supported.)

- --
HTH,
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHJ5PJ7M8hyUobTrERCG+hAKCDDe4mHbU0miqdW+sF41mgZ8Gz3wCZAUZi
9FZnWWOOC4C67KpttH4yOV0=
=/Thf
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]