portability

What version of Python should I be using to develop web applications?

Currently I have python 3.1.1 installed on my system, same version on my server with WSGI 3.0 running on Apache 2.2. I want to keep using python 3.1, but I'm finding that lots of libraries/frameworks don't support it yet, namely Django, Pylons, MySQLdb, etc. I also checked an account I have on a friend's server, and it is running pytho...

Best way to query different database engines in a uniform way?

I work on a C# client application (SlimTune Profiler) that uses relational (and potentially embedded) database engines as its backing store. The current version already has to deal with SQLite and SQL Server Compact, and I'd like to experiment with support for other systems like MySQL, Firebird, and so on. Worse still, I'd like it to sup...

To which extent is "boost does it" equivalent to "very portable, use it"?

In this answer to a question asking "is doing Z this way portable" the idea is "boost does it this way, it means it is very portable". Can I just always consult boost sources to find the most portable way of doing something in C++? How can I judge for myself if boost is really such a collection of super-portable code? ...

Portability of a C code

I have the following code int main() { int a=6; void *p; p=&a; p++; } Does the void pointer here increment by a particular value (if it is holding the address of any data type) ? In the above case p increments by 1 even though it is pointing to an integer value. According to me the above code invokes Implementation Define...

Does operator new allocate on THREAD heap?

My problem seems to be this: heap data allocated by one thread (that later dies) seems to die as well. As so: Thread X: starts Thread Y: starts Thread X: ptr = new some bytes Thread X: dies Thread Y: tries to use ptr - and crashes! So far, I've only seen this problem on Darwin (Mac OS 10.5 and 10.6), but haven't tried more other plat...

portable way to deal with 64/32 bit time_t

I have some code which is built both on Windows and Linux. Linux at this point is always 32bit but Windows is 32 and 64bit. Windows wants to have time_t be 64 bit and Linux still has it as 32 bit. I'm fine with that, except in some places time_t values are converted to strings. So when time_T is 32 bit it should be done with %d and w...

Portability among mobile platforms

Do any libraries or other development resources exist that can help reduce the effort involved in porting applications between various mobile platforms? In particular, I am interested in supporting iPhone, Android, and Windows Mobile. Some areas of concern include UI, client-server communication, and hardware support (e.g., camera, GPS...

cmake command syntax question

I require the syntax of a CMAKE macro that generates .cc and .h files from a tool like lex/yacc. Could someone please show me the syntax for the following contrived example: say I have a file y.cc that depends on x.cc and x.h, the two files mentioned are generated by tool z_tool from file x.z. What would the syntax for this be ? Fo...

int vs size_t on 64bit

Porting code from 32bit to 64bit. Lots of places with int len = strlen(pstr); These all generate warnings now because strlen() returns size_t which is 64bit and int is still 32bit. So I've been replacing them with size_t len = strlen(pstr); But I just realized that this is not safe, as size_t is unsigned and it can be treated as ...

C++ portable end of line

Hi everyone, is there any way to automatically use correct EOL character depending on the OS used? I was thinking of something like std::eol? I know that it is very easy to use preprocessor directives but curious if that is already available. EDIT What I am interested in is that I usually have some messages in my applications that I...

What's your recommandation for C Unit Testing Framework ?

The framework should be as portable as possible. Thank you! Later Edit: If possible I am looking for something similar (as approach) with Java's Junit. ...

Alternatives to fread and fwrite for use with structured data

The book Beginning Linux Programming (3rd ed) says "Note that fread and fwrite are not recommended for use with structured data. Part of the problem is that files written with fwrite are potentially nonportable between different machines." What does that mean exactly? What calls should I use if I want to write a portable structur...

What is meant by porting an application X to a platform Y ?

Pretty clear from the title itself, what is meant by porting an application X to a platform Y? Say for example I have an application X running on some OS, say Y, What do I do to port this application to another OS say Z? Does this mean rewriting a new application A for Operating system Z that necessarily imitates the behavior of applica...

Efficient way to create/unpack large bitfields in C?

I have one microcontroller sampling from a lot of ADC's, and sending the measurements over a radio at a very low bitrate, and bandwidth is becoming an issue. Right now, each ADC only give us 10 bits of data, and its being stored in a 16-bit integer. Is there an easy way to pack them in a deterministic way so that the first measurement ...

Compilation platform taking FPU rounding mode into account in printing, conversions

EDIT: I had made a mistake during the debugging session that lead me to ask this question. The differences I was seeing were in fact in printing a double and in parsing a double (strtod). Stephen's answer still covers my question very well even after this rectification, so I think I will leave the question alone in case it is useful to s...

About enumerations in Delphi and c++ in 64-bit environments

I recently had to work around the different default sizes used for enumerations in Delphi and c++ since i have to use a c++ dll from a delphi application. One function call returns an array of structs (or records in delphi), the first element of which is an enum. To make this work, I use packed records (or aligned(1)-structs). However,...

How do I build an app and framework on OS X 10.6 that can run on 10.5?

Here's my situation: I have the source code for a third-party framework that I want to include in my project. I'm developing on 10.6 but I want to support 10.5, so I have the base SDK and the deployment target set to 10.5. I can build the framework and the application, and the app runs inside Xcode and on the machine. However, it fails ...

Getting meaningful error messages from fstream's in C++

What is the best way to get meaningful file access error messages, in a portable way from std::fstreams ? The primitiveness of badbits and failbits is getting to be bit annoying. I have written my own exception hierarchies against win32 and POSIX before, and that was far more flexible than the way the STL does it. I am getting "basic::i...

Help with proper character encoding.

I have a HTML form that is sometimes submitted with accented characters: à, è, ì, ò, ù I have a PHP script that exports these form submissions into CSV format, when I look at the CSV format in a text editor (vim or notepad for example) the characters look fine, but when opened with Open Office or Word, I get some funky results: ����� I...

Doctrine SQL query: works on MySQL, on PostgreSQL won't

This is a query automatically generated by Taggable extension for Doctrine ORM. SELECT t.id AS t__id, t.name AS t__name, COUNT(DISTINCT i.id) AS i__0, (COUNT(DISTINCT i.id)) AS i__1 FROM taggable_tag t LEFT JOIN cms__model__image_taggable_tag c ON (t.id = c.tag_id) LEFT JOIN image i ON i.id = c.id WHERE t.id IN (SELECT doctrine_s...