[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 580: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 636: sizeof(): Parameter must be an array or an object that implements Countable
3.14.by forum • That is when C++ sucks
Page 1 of 1

That is when C++ sucks

Posted: Fri Jan 09, 2009 2:21 am
by BarsMonster
It appeared that you just cannot compile (without spending the whole day) Boost using Intel C++ 11 compiler. (And another piece of problems comes with 64bit mode)
This sucks. No portable library which working fine under any compiler and both 32/64bit :-S

pthreads is portable, but still not fully migrated to 64-bit, and I don't feel like I can spend a day compiling it and investigation why yet another thing does not work in 64-bit :wall:

So I have to get rid of Boost, or Linux support, or Intel C++.. Or write my own yet-another library which will launch threads/support mutexes under windows, and will wrap pthreads under linux :wall:

Re: That is when C++ sucks

Posted: Fri Jan 09, 2009 2:22 am
by BarsMonster
Or probably I am just falling into depression :crazy:

Re: That is when C++ sucks

Posted: Fri Jan 09, 2009 12:52 pm
by Maratyszcza
Intel Compiler 11 comes with Intel Threading Building Blocks - a platform-independent library of concurrent primitives. Use could use them instead of Boost.Threads

Re: That is when C++ sucks

Posted: Fri Jan 09, 2009 1:42 pm
by BarsMonster
I don't need that much threads :-)
Also, not sure if I would loose ability to compile the code with MSVC & GNUC when needed

Re: That is when C++ sucks

Posted: Fri Jan 09, 2009 2:20 pm
by Corni
Why do you need to spend the whole day compiling boost? I remember me doing a build of boost under linux 32bit with gcc, and it took just ~1-2hours building, but nothing complicated to start the build :P
Why are you using the Intel compiler anyway? Just use gcc for all platforms => done :P

Re: That is when C++ sucks

Posted: Fri Jan 09, 2009 2:50 pm
by BarsMonster
Corni wrote:Why do you need to spend the whole day compiling boost? I remember me doing a build of boost under linux 32bit with gcc, and it took just ~1-2hours building, but nothing complicated to start the build :P
Why are you using the Intel compiler anyway? Just use gcc for all platforms => done :P
Because it does not compile out of the box with Intel C++ 11, thread discussing this on the boost forum ended that they need to wait while Intel would fix the compiler :-)
Intel C++ offers 10-15% higher performance than MSVC on my tests.
It would be nice to know how gcc works, but I guess Intel C++ is still faster, as they still release it under linux :-)

Re: That is when C++ sucks

Posted: Fri Jan 09, 2009 9:08 pm
by Corni
yeah, if you test with latest intel processors, intel compiler will probably produce the best optimized code. But does this really matter for you? I don't know about GPGPU, but the GPU speed shouldn't be affected by this, as compiling this is up to CUDA, isn't it?
Btw lol@intel compiler not being able to compile boost. SPEC should include boost speed checks, guess how fast boost would be supported then ;)

Re: That is when C++ sucks

Posted: Sat Jan 10, 2009 5:58 pm
by BarsMonster
Well, It always happens with new major version(11) released :-)
Thing here and there stopping working :-)

Re: That is when C++ sucks

Posted: Tue Jan 13, 2009 4:42 am
by BarsMonster
I must admit that was dumb me, not Intel :crazy: (Damn, why all the time I am being dumb, but not AMD, nVidia, Intel and Microsoft? :crazy:)
Just needed to run iclvars_intel64.bat (bjam was trying to launch it, but had a double forwardslash, and therefore, path was wrong) and everything became fine, but that was quite a random luck :-) I cannot imagine how not having some env variables causes windows popups saying that it does not know how to open .rsp files :-)

Just a record for myself:

Code: Select all

bjam --toolset=intel-win address-model=64 --with-thread stage --target=release
Anyway, that is too late for Boost, everything was already migrated to Poco (although Intel C++ hangs while compiling my code :crazy: still need to find a workaround), and Poco looks better when working with threads(especially threads - it have thread priority crossplatform, and it has both recursive and faster non-recursive mutexes (which I am using, hope they are faster than Boost's ones)) and timer-stuff(at least they try to support 100ns accuracy).

Re: That is when C++ sucks

Posted: Tue Jan 13, 2009 6:53 am
by BarsMonster
Intel C++ fun:

class algo {
virtual method a;
}

class algo_md5 : public algo
{
method a;
method b;
}

algo *tmp = new algo_md5();


(algo_md5*)tmp->a();
(algo_md5*)tmp->b();

This code hangs Intel C++ compiler :-) Making both a & b virtual in base class solves the problem. :crazy:

Re: That is when C++ sucks

Posted: Tue Jan 13, 2009 7:16 am
by BarsMonster
It appeared that it hangs only if method b have alot of SSE2 code (around 70% of MD5 :crazy:)

Re: That is when C++ sucks

Posted: Wed Feb 18, 2009 10:12 pm
by BarsMonster
Intel guys confirmed that my bug was fixed, and new version of Intel C++ released with this fix :crazy:

Re: That is when C++ sucks

Posted: Mon Jan 11, 2010 4:31 am
by BarsMonster
One more mistery that ate like 15 hours of debugging and hitting my head over the wall :wall:
I had crashes inside POCO network library for misterious reason. I was really frustrated about it. I haven't seen other way of solving this issue but asking their support forums (not very active unfortunately..)
Google had 0 info about any of similar problems... Finally, how can you write software that supposed to work on large variety of hardware, when it crashes on your own PC? Non-reliable library? How can I trust it?

I was nearly ready to get rid of POCO and go with platform-specific network code...

Today I had yet another multi-hour debilitating debugging session..
After useless trials to find an issue in Poco (googlling, trying different versions, checking support forums, e.t.c) I've gone standard way of solving (virtually) unsolvable problems:
I got rid of Intel C++, 99% of the code, and gone down to copy&pasted httpget example from poco... It worked in the POCO project, but not inside Salty Cracker project, where it horibly crashed every time while resolving hostname, or sending request... Crash places were different with different config (static/dll POCO, static/dll CRT). So, I supposed it was project settings, and started to "unify" them one-by-one until...

It was simple.

_SECURE_SCL=0

I needed that to build Boost, and had that in main Salty_cracker project. But I haven't used it when compiling Poco library, so libs were just incompatible :crazy:

During all these longs hours of head-scratching the only through made me feel a little better: I was thinking that someday I will say "Wow, that was so simple, it is so great and reliable now!" :crazy: :joy: :crazy:

Re: That is when C++ sucks

Posted: Mon Jan 11, 2010 4:41 am
by BarsMonster
I feel so great... :crazy:
No more heroin, Let's stick to solving tough problems since today :crazy:

Re: That is when C++ sucks

Posted: Mon Jan 11, 2010 7:52 am
by LordMike
lol.. :P