GNU bug report logs -
#51484
[PATCH] Move runtime check for recent giflib to compile time
Previous Next
Reported by: Stefan Kangas <stefan <at> marxist.se>
Date: Fri, 29 Oct 2021 14:44:02 UTC
Severity: wishlist
Tags: patch
Done: Stefan Kangas <stefan <at> marxist.se>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 51484 <at> debbugs.gnu.org (full text, mbox):
> From: Stefan Kangas <stefan <at> marxist.se>
> Date: Fri, 29 Oct 2021 07:42:56 -0700
>
> I'm looking into some bugs in how we handle gifs, and I see that we
> check for GIFLIB_MAJOR at runtime.
Only once, right?
> Is there any reason not to do it at compile-time as in the attached
> patch?
(What patch?)
The compiler converts that into a run-time constant anyway. The
reason for using such "run-time" testing is usually to have a more
readable code, since #ifdef's make the code harder to read. There are
no downsides, since the test is compiled away.
> I expect that GCC is smart enough to see that "5 < 4" is always false
> and optimize this all away, and probably also won't include unused
> static variables, so maybe this doesn't matter. But I think it's nice
> to be a bit more explicit, and I guess it can't hurt to see warnings if
> anyone tries using interlace_start and interlace_increment outside of
> their intended use.
I don't think I understand what scenario you have in mind where having
an #ifdef would be better. Please elaborate.
This bug report was last modified 3 years and 262 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.