|
Allegro Naming Conventions |
Chris Katko
Member #1,881
January 2002
|
I was reading through the discussion of the api-style (draft two) for Allegro 5. And if I'm correct, Allegro 5 will be prefix functions with al_, Al_ or Al. I personally prefere the first, but that's beyond the scope of this thread. The problem I see with this, is that OpenAL already does this. Exactly. So this could create some confusion couldn't it? OpenAL prefixes functions with "al" and constants with AL_. What happens if Allegro does the same and someone uses both libraries together? (Which is not as far-fetched as you would think.) What's your thoughts on this? -----sig: |
Marcello
Member #1,860
January 2002
|
namespaces |
Chris Katko
Member #1,881
January 2002
|
It's pointed out in the article that Allegro 5 will have no C++ (unless I missed something) and will therefor have no namespaces. [edit] Took me a sec to find it again (it's quite big). Quote: Allegro 4 and previous include little C++ code, but this is very probably going to be dropped in the next version).
-----sig: |
Marcello
Member #1,860
January 2002
|
That's a pretty old file, have you been reading the alleg5 list? From what I recall there was a push to more c++ in version 5. As for namespaces, I was joking. Obviously. Marcello |
Thomas Fjellstrom
Member #476
June 2000
|
There will only be a problem if OpenAL and Allegro have an identically named identifier. No problems otherwise. Oh, and one of the UWIP's (Uber Work In Progress) for Allegro 5 uses C++ in the core for the driver system. but exposes a C and C++ compatable API to the user. -- |
Chris Katko
Member #1,881
January 2002
|
The Alleg5 mailing list? I forgot about that. I'm talking about the documents in the "Allegro's future proposals" section. Most aren't that old. [edit] 1 post hit while I was writing. TF: I'm mostly talking about readability (which the document was about). -----sig: |
Bob
Free Market Evangelist
September 2000
|
The C++ thing is for internals only. The Allegro API will remain C only. Yes, we do know prefixes still have issues: OpenAL uses the same ones, and so do several other libraries. It's not something we can really avoid - there simply is no way to isolate expoerted C code. (edit: s/OpenGL/OpenAL/) -- |
CGamesPlay
Member #2,559
July 2002
|
"C only" <-- Really? The C++ won't be exposed at all? -- Ryan Patterson - <http://cgamesplay.com/> |
A J
Member #3,025
December 2002
|
all my wisdom tells me C++ internal and C extern is a REALISTIC WORKABLE SOLUTION. those 3 words are VERY important. as for AL_ i suggest alg_ much better chance of it avoiding name conflicts. ___________________________ |
Chris Katko
Member #1,881
January 2002
|
Wouldn't "all_" work? -----sig: |
Bob
Free Market Evangelist
September 2000
|
Just to be sure, it should be allegro_game_programming_library_. No confusion could possibly arise from such a prefix. -- |
23yrold3yrold
Member #1,134
March 2001
|
OpenAL and Allegro may both use the "al" prefix, but the function naming conventions beyond that are different (mixed caps vs. underscore mania). I wouldn't sweat it ... -- |
Chris Katko
Member #1,881
January 2002
|
Bob! Let's just port Allegro to C# and only support C# that way, EVERYONE is happy! Namespaces! Circular dependances! It's heaven! Back to sanity: I don't think it'll matter much either 23, but to be sure, I thought I'd ask here, just incase is hasn't been thought about. -----sig: |
Evert
Member #794
November 2000
|
I've been thinking about this... wouldn't it be possible to encapsulate the contents of allegro.h in something like namespace allegro { extern "C" { // stuff } } depending on __cplusplus being defined and some preprocessor flag to indicate we Allegro wrapped up in a namespace (making it the default will break older code)? Alternatively, one could make a seperate header file that does this. If it works at all (and due to the way Allegro mangles some things through #defines and inline functions, I'm not at all sure that it would) this would solve the namespace issue only for C++, not for C, but it has the advantage that it could be done now and quickly. And some solution is probably better than none. |
MindCode
Member #2,031
March 2002
|
I still don't understand the aversion to C++ to begin with. Clearly people who use C ONLY won't be able to use C++ code. But who is so hardcore C that they don't use C++? Is there really anyone out there who refuses to use C++? (which has been standardized as of 2 years ago) If these strange and illusive people are out there maybe someone should slap them back to reality. ______________________________________ |
Chris Katko
Member #1,881
January 2002
|
Well, C is "faster" then C++. Which is actually true, but the fact that John Carmack has given C up for Doom 3 should say something about the overhead being not a real issue. I think nowadays, it's just a preferance issue, except on embedded systems (not consoles, actual embedded systems). Though I wish I could get some of those circular dependances (a C# feature) in C++... [edit] Was that directed at me, Matt? -----sig: |
Matthew Leverton
Supreme Loser
January 1999
|
I prefer to use C over C++ for any project that I'm going to be doing solo. If I wanted C++ Allegro, I could create a wrapper of sorts around any features that I really cared to have as OOP. You are shallow minded if you think C++ is always better than C. There's more out there than just high-end PCs, and there's more than just large scale projects that benefit from OOP. |
Thomas Fjellstrom
Member #476
June 2000
|
Quote: But who is so hardcore C that they don't use C++? I've said it many times. but its not a "hardcore" thing. I prefer C, as I over engineer when coding in C++, designing an API takes me way too long in C++, so I do C, and C works perfectly fine. I don't need any of the C++ features. (some of them even slow me down...) Quote: If these strange and illusive people are out there maybe someone should slap them back to reality. Can I slap you? Please? No really. Don't assume things about people, it tends not to be too accurate. -- |
kronoman
Member #2,911
November 2002
|
Quote: The C++ thing is for internals only.
Question: I mean, for example, If I only have installed GCC, but not GPP, it will still be possible to compile Allegro? |
Bob
Free Market Evangelist
September 2000
|
Quote: mean, for example, If I only have installed GCC, but not GPP, it will still be possible to compile Allegro? Nope, you will require a C++ compiler. Btw, none of this is set in stone. We're just experimenting with some things. For example, my version of the code only uses C, and implements Java-style dynamic binding. Peter's C++ version requires that add-ons and user code be compiled with a common ABI to share Allegro internals. -- |
Evert
Member #794
November 2000
|
Quote: But who is so hardcore C that they don't use C++?
I hardly use C++ at all. The only reason I'm writing C++ code at the moment is because I had a good use for object inheritance and constructor/destructor functions. Quote: Is there really anyone out there who refuses to use C++? (which has been standardized as of 2 years ago) It being standardized is not an issue. FORTRAN has been standardized over twenty-five years ago, and I don't actively use that either. |
Trezker
Member #1,739
December 2001
|
I think we should leave the c coders alone. I think it would be stupid to make separate versions to please both sides. Matthew: Don't forget that OOP is available in c too, struct, DIALOG object... |
A J
Member #3,025
December 2002
|
anyway, what can C++ do that C cant ? ___________________________ |
Evert
Member #794
November 2000
|
Quote: anyway, what can C++ do that C cant ? In a sense, nothing, in another sense, a lot. C and C++ both compile to machine code, so either language can do what the other does from the machine's point of view. C++, however, offers functionality to the programmer that C does not: operator overloading, namespaces, polymorphism. |
Trezker
Member #1,739
December 2001
|
C++ is offering some higher level coding, what you use depends on what suits you best. |
|
|