Re: (no subject)
Basil Mohamed Gohar <[email protected]>
| Newsgroups | gmane.comp.multimedia.ogg.theora.general |
|---|---|
| Message-ID | <[email protected]> |
On 06/10/2010 05:16 PM, Gregory Maxwell wrote: > It's worth elaborating on this, because I don't want people thinking > that libtheora has known and unfixed problems accessing uninitialized > variables. > > > In libtheora there are a number of places where an initialization > isn't obvious to a compiler, usually due to cross function boundaries. > Some of these places are performance critical. > > In order to suppress compiler warnings in places where they would > incorrectly warn of missing initialization libtheora initializes a > variable to itself. e.g. > > int a=a; > > This odd looking code causes GCC (for example) to emit nothing at all, > so it's the same as "int a;" but it suppresses the warning. > > For some odd reason, the Microsoft tool-chain actually generates code > for the a=a case and then the runtime checker warns on it. It's a > harmless warning, however. > > The valgrind tool we use on GNU/Linux is far more intelligent with > uninitialized access checks and isn't confused by this at all. > Greg, Thank you for taking the time to explain this. I think it's due to my ignorance of C that I am not aware of such issues, so when I see a plethora of warnings here-and-there in some cases (not necessarily with libtheora, but perhaps other packages), I always wonder, "Why did the devs do that?!", as I tend to be quite pedantic and would imagine that a warning means "don't do that". Apparently this is not always the case, and it's just the nature of C that it's not always clear what is to be expected, at least to the compiler.