[Top][All Lists]

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

[Bug-glpk] Minor patch for recent glpk up to version 4.37

From: Nelson H. F. Beebe
Subject: [Bug-glpk] Minor patch for recent glpk up to version 4.37
Date: Tue, 31 Mar 2009 02:11:21 +0300

Versions 4.35--4.37 of glpk have failed to build on SGI IRIX MIPS, but
I only today had the time to figure out why.

The problem is this definition in the native <ctype.h> file:

    #define _G       0x40000000      /* Graphic characters only */

It conflicts with this piece of code in src/glpnet03.c:

    int glp_netgen(glp_graph *_G, int _v_rhs, int _a_cap, int _a_cost,
          const int parm[1+15])

The rules of ISO Standard C (1989 and 1999) are that names beginning
with two underscores, and names beginning with an underscore and a
capital letter, are reserved for the implementation.  Thus, IRIX is
permitted to define _G as shown above, and glpk is in error in using
that name for its own variables.

As a quick workaround, I made this simple patch to include/glpstd.h:

% diff -c include/glpstd.h.~1~ include/glpstd.h
*** include/glpstd.h.~1~        Sun Mar 29 03:00:00 2009
--- include/glpstd.h    Mon Mar 30 15:33:04 2009
*** 37,42 ****
--- 37,44 ----
  #include <string.h>
  #include <time.h>

+ #undef _G

  /* eof */

The package then built correctly, and passed its validation test.

I suggest changing the initial underscores in local variables
and function arguments to be trailing underscores, in order
to easily avoid vendor namespaces.

Otherwise, the author(s) of glpk is(are) to be congratulated on its
portability.  I've routinely built it from version 4.29 onward on
about 25 flavors of Unix, and the success rate is almost universal.

- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- University of Utah                    FAX: +1 801 581 4148                  -
- Department of Mathematics, 110 LCB    Internet e-mail: address@hidden  -
- 155 S 1400 E RM 233                       address@hidden  address@hidden -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe/ -

reply via email to

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