Archive

Archive for the ‘c/c++’ Category

No shit, Sherlock?

April 8th, 2013 No comments

This is how my IDE welcomed me today. I have to say I’m using it for several years and like the TotDs, because they usually contain nice hints…well not this day I think. 😀

Codeblocks TotD

Codeblocks TotD

Categories: c/c++, fun, nerdcore, software Tags: ,

clang++ vs. g++ 1:0

March 5th, 2013 2 comments

Oder wieso man wirklich clang(++) benutzen sollte, wenn es drauf ankommt. Was sagt Euch diese g++ Fehlermeldung?

In file included from ../include/build.h:6,
                 from lexyacc.h:4,
                 from chapel.ypp:18:
../include/stmt.h:108: error: multiple types in one declaration

Es sei dazu gesagt, dass auf Zeile 108 irgendwelcher Code steht, den ich nicht angefasst habe. Aussage gleich null. Schauen wir was clang++ daraus macht:

In file included from ../include/build.h:6:
../include/stmt.h:92:2: error: expected ';' after class
}
 ^
 ;
1 error generated.

UND WIESO IHR GNU SPASSEMACKEN KÖNNT IHR MIR DAS NICHT SAGEN? Mann du … 30min Zeit verschwendet weil man aus versehen ein Semikolon gelöscht hat und der Compiler zu dämlich ist vernünftige Fehlermeldungen zu werfen. Kann mir irgendwer erklären wieso dieser g++ und gcc Dreck so dermaßen dämlich ist, gibt es da irgendeinen triftigen technischen Grund für?

Categories: c/c++, nerdcore Tags: , , ,

clang vs. gcc @ Lie-Reihen

June 25th, 2012 No comments

Zu Debugging-Zwecken mal clang für meinen Bahnintegrator benutzt. Bin echt erstaunt, der Code läuft auf einmal acht mal so schnell. Cool!

./clang.bin > /dev/null  0.58s user 0.00s system 99% cpu 0.583 total
./gcc.bin     > /dev/null  4.78s user 0.01s system 99% cpu 4.794 total

Scheinbar stimmen die Werbeversprechen.

Categories: c/c++, nerdcore, science Tags: , ,

Code::Blocks my new favoured IDE?

November 27th, 2011 3 comments

Not so long ago we argued about programming languages and IDEs. As expected several worlds collide. So maybe there is no answer to the question what’s best, but I want to draw your attention to a nice IDE.

I needed a platform-independent and comfortable tool for programming. One would say “Use Eclipse” but my past with Java and Eclipse was bad. Or one would say “Use Emacs or Vim, stupid”, true but Linux tools on Windows mostly are pain in the ass. What I finally found was Code::Blocks, available for Linux, Windows and MAC. It’s a nice, fast and in my opinion mighty IDE for C and C++ (other languages via plugins). It needs a bit time to get familiar with it but there are very powerful features making this worthwhile. I don’t want to waste your time anny longer so try by your own.

Little hint: the version receivable from the last Ubuntu LTS is ooooold so download debs from the website.

screen shot of codeblocks

URL: www.codeblocks.org

Categories: c/c++, linux, software Tags: ,

Programming Language Rant

November 15th, 2011 4 comments

From http://www.esm.psu.edu/~ajm138/fortranexamples.html:

C programmers love to gloat that recursion can not be done in Fortran. When they say Fortran, they mean FORTRAN 77, since they absolutely refuse to acknowledge the existence of modern Fortran 90. (Fortran 90 came out over ten years ago. You would think they might know something about it by now!) But this example shows that even in FORTRAN 77 one can quickly and easily write routines that are recursive. So stick that in your complex variables, C programmers, and — oh wait, I forgot there are no complex variables in C. You have to manually define a complex data type. Not to mention having to write math functions like sin( ) and cos( ) to handle such data types.

Hahaaa … love it!

Categories: c/c++, nerdcore Tags: , ,

Code snippet found on my disk . . .

July 11th, 2011 2 comments
int m=167772161,N=1,t[1< &lt;25]={2},a,*p,i,e=34893349,s,c,U=1;g(d,h){for(i=s;i&lt;1<<
24;i*=2)d=d*1LL*d%m;for(p=t;p<t+N;p+=s)for(i=s,c=1;i;i--)a=p[s]*(h?c:1LL)%m,p[s]
=(m+*p-a)*(h?1LL:c)%m,a+=*p,*p++=a%m,c=c*1LL*d%m;}main(){while(e/=2){N*=2;U=U*
1LL*(m+1)/2%m;for(s=N;s/=2;)g(17,0);for(p=t;p<t+N;p++)*p=*p*1LL**p%m*U%m;for(s=1
;s<N;s*=2)g(29606852,1);for(a=0,p=t;p<t+N;)a+=*p<<(e&1),*p++=a%10,a/=10;}while(!
*--p);for(t[0]--;p>=t;)putchar(48+*p--);}

It is definitely not my code 😉 . . . any guesses??

[update1]
As there were some offline discussions, here the original file as a download: Download File

[update2]
This is were I most probably got the code from: http://bellard.org/mersenne.html

Categories: c/c++ Tags:

PathScale gibt 64-Bit Compiler Suite frei

June 15th, 2011 No comments

Die aus Compilern für C/C++ und Fortran für x86 Prozessoren, dem Debugger PathDB, sowie Bibliotheken und Dokumentationen bestehende Suite EKOPath 4, wurde unter liberale bzw. freie Lizenzen gestellt. Die Anwendungen sind für Linux, FreeBSD und Solaris erhältlich.

Read more at ProLinux and PathScale

Shortlink: Intel Non-Commercial Compiler

October 21st, 2010 No comments

Vortrag – heute

October 8th, 2010 No comments
Categories: c/c++, hpc, linux Tags: , , ,

entia non sunt multiplicanda praeter necessitatem

March 11th, 2010 2 comments

Or in other words

entities must not be multiplied beyond necessity

This is also known as Ockham’s razor. The computer scientist mostly refers to the somehow similar KISS principle

keep it simple [and | ,] stupid

Even Einstein said something in that direction:

everything should be made as simple as possible, but no simpler

I just read source-code that reminded me to adhere to the common deeper meaning of  all of these “sayings” to never produce code like the one I was looking at 😉

Categories: c/c++, software Tags: ,