Archive

Archive for the ‘c/c++’ Category

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: ,

icc 11.1.059 on ubuntu 9.10

November 3rd, 2009 No comments

ICC und Ifort gibt es non-commercial for free: http://software.intel.com/en-us/articles/non-commercial-software-download/

Unter Ubuntu 9.10 ist die Installation etwas hagelig. Hier eine kleine Hilfestellung:

Es werden trotz Intel64 Installation noch einige 32bit libs benötigt

apt-get install lib32gcc1 lib32stdc++6 libc6-dev-i386 gcc-multilib ia32-libs

Ubuntu 9.10 bringt nur noch die libstdc++6 mit es wird aber auch Version 5 gebraucht. Einen Symlink setzen funktioniert wegen der inkompatiblem API nicht.
Unter http://packages.debian.org/stable/base/libstdc++5 kann sowohl die 32 als auch die 64bit Version eines passenden Debian Pakets bezogen werden.
Installieren dann mit

dpkg -i libstdc++5_3.3.6-18_amd64.deb

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

programming-wtf

October 27th, 2009 2 comments

Ich bin heut bei der Arbeit auf einen netten Codeabschnitt gestoßen, in Datei A stand:

osm_port_t *port = cl_item_obj(item, port, list_item);

So weit so gut, nur was ist dieses ‘list_item’? In der Funktion und in der Datei ist es zumindest nicht enthalten, also mal grep -R ;)

In Datei B hab ich dann diesen Spaß gefunden:

#define cl_item_obj(item_ptr, obj_ptr, item_field) (typeof(obj_ptr)) \
((void *)item_ptr - (unsigned long)&((typeof(obj_ptr))0)->item_field)

Ok, vollsten Respekt vor dem Schreiber für seinen Hack, den ich immer noch nicht verstanden hab. Ist aber auch nicht ganz so wichtig, zumal wenn ich ihn verstehen würde, würde ich ihn nicht mehr so toll finden ;)

ABER: wie zur Hölle kann man so was undokumentiert lassen!? (nix, nada, no comment)

PS: wer noch wissen will woher das stammt, aus dem SubnetManager von InfiniBand (open-source wohlgemerkt)

Categories: c/c++, hpc, linux, wtf Tags:

open64

October 16th, 2009 1 comment
Categories: c/c++, software Tags: , ,