library-design

Is requiring a certain order for #includes in c++ a sign of bad library/header design?

I've used some very large scale systems and never seen a required order, but came across it recently. Does the STL or STD library or even Boost have any cases where certain includes must come in a certain order? ...

Why does std::fstream set the EOF bit the way it does?

I recently ran into a problem caused by using fstream::eof(). I read the following line from here: The function eof() returns true if the end of the associated input file has been reached, false otherwise. and (mistakenly) assumed this meant that if I used fstream::read() and read past the end of the file, the function eof() would...

Architecture of some reusable code

I am writing a number of small, simple applications which share a common structure and need to do some of the same things in the same ways (e.g. logging, database connection setup, environment setup) and I'm looking for some advice in structuring the reusable components. The code is written in a strongly and statically typed language (e....

Where are the readonly/const in .NET?

In C++ you'll see void func(const T& t) everywhere. However, i havent seen anything similar in .NET. Why? I have notice a nice amount of parameters using struct. But i see no functions with readonly/const. In fact now that i tried it i couldnt use those keywords to make a function that promises to not modify a list being passed in. Is t...

How should I build a simple database package for my python application?

I'm building a database library for my application using sqlite3 as the base. I want to structure it like so: db/ __init__.py users.py blah.py etc.py So I would do this in Python: import db db.users.create('username', 'password') I'm suffering analysis paralysis (oh no!) about how to handle the database connect...

is it possible to design a better collections library than stl for c++?

the title says it all... now answer! ...

Writing a library with C and C++ interfaces, which way to wrap?

When preparing a library (let's call it libfoo), I find myself presented with the following dilemma: do I write it as a C++ library with a C wrapper: namespace Foo { class Bar { ... }; } /* Separate C header. #ifdef __cplusplus omitted for brevity. */ extern "C" { typedef void *FooBar; FooBar* foo_bar_new() { return new Foo...