[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] const char *
From: |
Andrew Makhorin |
Subject: |
Re: [Help-glpk] const char * |
Date: |
Sat, 19 Jun 2004 15:00:42 +0400 |
>A number of the GLPK API functions (e.g.
>lpx_read_model) take char * arguments, where
>const char * would seem more appropriate.
>
>Why is this? Is there some reason why these
>functions may modify the given string? Am I
>missing something here? It is somewhat
>irritating, because if I pass them a string
>declared const char * I get a compiler warning
>about discarding qualifiers.
`const' qualifiers are not used for portability reasons (Glpk is
written in a subset of ISO C which does not include such feature).
If you need to get rid of compiler warnings, you might use explicit
type conversion as follows:
void foo(const char *filename)
{
...
ret = lpx_read_mps((char *)filename);
...
}
(or do not use const's at all :+)
Andrew Makhorin