I’ve been holding off on writiing a post until I had some significant chunk of code I could point to to show that I’m making progress. Well, I am making progress, but there’s no “significant amount” of code yet. I’m not worried about the slow start, because what I’m doing makes sense and I am writing code, but there are still so many things I run into every day where I have to stop and look something up to try to figure out why it was done a particular way. Almost all of the confusion comes from the TianoCore codebase, which is 1) huge, and 2) written in a consistent but unfamiliar style. Like this line,
IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor OPTIONAL,
What’s with the IN, OUT and OPTIONAL? I haven’t been able to find them defined anywhere, I’m assuming they’re special comments that Visual Studio knows about, but I haven’t found any reference to them. In comparison, reading the coreboot code is fun and easy. It’s just straightforward c.
Yes I think it has something to do with MS Structured annotation language. I think you can define them to nothing. Try google for __in __out __in_opt
Thanks Rulk. I hadn’t known what to google for. I found where they’re defined in the TianoCore sources,
https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/MdePkg/Include/Base.h
And yes, they mean nothing: “#define IN”.
Now, I’m a relative novice at this, both open-source and professional coding, but that seems like bad style, to include something special IN ALL CAPS that means nothing. This isn’t meant as criticism of the Intel programmers who wrote this; they’re probably smarter than me and definitely better programmers, and when they wrote it it wasn’t meant to be open source, so they were right to conform to whatever coding conventions (and compiler choices) were dictated. But, now that it is open source, these clever, nonstandard additions to the code just get in the way. (In the code I’m reusing, I just remove them).
ALLCAPS is not meant as shouting in C: It’s quite common to use capital letters for preprocessor macros – just like IN and OUT 🙂