[fixed]small things

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
AReichl
Posts: 270
Joined: Wed Jul 13, 2011 2:34 pm

[fixed]small things

Post by AReichl »

Should't
#pragma comment(lib, "Irrlicht.lib")
and
#pragma comment (lib, "irrKlang.lib")
be enclosed in #ifdef _MSC_VER instead of #ifdef _IRR_WINDOWS_ ?

In sound.cpp of example 21:
virtual const ik_c8* getFileName() { return file->getFileName().c_str(); }
instead of
virtual const ik_c8* getFileName() { return file->getFileName(); }

about swprintf:
i had problems with this when i compiled with gcc-TDM.
I could solve them by swapping the sequence of some headers
( meaning driverChoice.h on top of irrlicht.h ):
#include "driverChoice.h" // solves problem with TDM.
#include <irrlicht.h>
With other compilers ( e.g. from the mingw-w64 project ) i had no problems.
This is something i hate about C++.
In latest trunk there is swprintf_irr, which is the best solution right now.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: small things

Post by CuteAlien »

Thanks, I've changed it all.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
AReichl
Posts: 270
Joined: Wed Jul 13, 2011 2:34 pm

Re: [fixed]small things

Post by AReichl »

again about s[n,w]printf:

- swprintf was added in C95 while snprintf was added in C99.
- the return values behave differently; with snprintf you can check against the buffer size and "reallocate" if necessary, with swprintf you get '-1' if SOMETHING went wrong, but you don't know what.

I always wondered, why there is no swnprintf or snwprintf, but there IS a snwprintf!
I have tried it with gcc 4.8.x. I am not sure about other compilers (Visual Studio > 2010 should have it), but don't let yourself be confused by this post - leave it as it is know (it works). If there should be any problems in the future, you can still change it if necessary.

I will have a look into other solutions from other libraries.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: [fixed]small things

Post by CuteAlien »

Also note that all those don't work on Android. Something I run into last year. I probably should go through the source again at some point and check for all those places if any of them matter on that platform and find other solutions there.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: [fixed]small things

Post by hendu »

They don't even work on Windows, which is the reason for the char-wchar converter functions.
Post Reply