Rasmus​.krats​.se

This page in English

Inlägg taggade ”c++”

Skriverier då och då, på webben sedan 1994.

Destruktorer och defer

Publicerad 2014-11-09 00:10. Taggat , , , , , .

En av de saker jag verkligen gillar i c++ är att man kan ha lokala variabler som är objekt i kombination med att objekt har destruktorer. När man lämnar ett scope där det finns lokala variabler kommer deras destruktorer omedelbart att köras, oavsett hur man lämnar scopet. Det ger ett trevligt sätt att hantera öppna filer, databaskoppel, mutexar och annat som behöver stängas. Andra språk har andra, ofta krångligare, sätt att få motsvarande resultat.

Språket go har en helt annan aproach, som är värd att titta lite närmare på.

Läs hela Destruktorer och defer med 2 kommentarer.

Optimizing a C++ program

Posted 2005-03-26 12:00. Tagged , , , .

A small case study of how to optimize a C++ program.

Read whole Optimizing a C++ program.

Iostream performance in gcc 3.4

Posted 2004-07-21 12:00. Last updated 2004-07-23 12:00. Tagged , , , .

I did a small performance test of gcc 3.4 compared to earlier versions. I think it is safe to say that standard c++ iostreams performance is greatly improved in gcc 3.4.

Update 2004-07-23: Implemented the tests in c as well, as a comparison.

Read whole Iostream performance in gcc 3.4.

StyleScript

Posted 1998-12-14 12:00. Last updated 2003-12-28 12:00. Tagged , , , .

An open-source HTML / SGML printer that uses CSS2.

StyleScript reads a HTML / SGML file, local or from an URL, and writes a Postscript file. I use the sp library, so only files that names a dtd and conforms to it is supported.

If your document passes the W3C validator without errors, it should be printable.

Update 2003-12-28: StyleScript is dead, viva Passepartout

Read whole StyleScript.

webredirect

Posted 2001-01-17 22:34. Last updated 2003-07-17 12:00. Tagged , , , .

A small web server serving “301 Moved Permanently” or “302 Moved Temporarily” to all requests.

Update 2003-07-17: Relase 0.3 of webredirect is out on the ftp server. The main news in this release are:

Updated the C++ language usage, so this version works with gcc 3.x (and should work with other standard-compliant C++ compilers).

Read whole webredirect.

incu or ++Unix

Posted 2000-12-19 12:00. Tagged , .

Unix facilities for C++ programmers

The aim of ++Unix is to allow C++ programs to use Unix facilities, such as sockets, whose interface includes a lot of pointers and other low-level stuff, and might vary on different kinds of Unix, in a nice, simple and consistent way.

One of the goals: There should be no need for preprocessor conditionals (#if) other than as include guards in a C++ programs that uses ++Unix.

Read whole incu or ++Unix.