Search Results

Search found 5 results on 1 pages for 'pierrebdr'.

Page 1/1 | 1 

  • Using Apple autorelease pools without Objective-C

    - by PierreBdR
    I am developing an application that needs to work on Linux, Windows and Mac OS X. To that purpose, I am using C++ with Qt. For many reasons, on Mac OS X, I need to use CoreFoundation functions (such as CFBundleCopyBundleURL) that creates core objects that need to be released with CFRelease. But doing so generate a lots of these warnings: *** __NSAutoreleaseNoPool(): Object 0x224f7e0 of class NSURL autoreleased with no pool in place - just leaking All the code I've seen concerning these autorelease pools are written in Objective-C. Does anybody know how to create/use autorelease pools in C or C++?

    Read the article

  • How to check if a file is a DLL?

    - by PierreBdR
    Given a file, I want to check if this is a DLL, or a shared object (Linux) or a dylib (Mac OS X), or something different. My main interest is differentiating executable and DLL on Linux and Mac OS X. For windows, the extension should be enough for my problem. I already checked that the magic number technique doesn't work for Linux as executable and shared objects both have the same number.

    Read the article

  • Visual C++ doesn't operator<< overload

    - by PierreBdR
    I have a vector class that I want to be able to input/output from a QTextStream object. The forward declaration of my vector class is: namespace util { template <size_t dim, typename T> class Vector; } I define the operator<< as: namespace util { template <size_t dim, typename T> QTextStream& operator<<(QTextStream& out, const util::Vector<dim,T>& vec) { ... } template <size_t dim, typename T> QTextStream& operator>>(QTextStream& in,util::Vector<dim,T>& vec) { .. } } However, if I ty to use these operators, Visual C++ returns this error: error C2678: binary '<<' : no operator found which takes a left-hand operand of type 'QTextStream' (or there is no acceptable conversion) A few things I tried: Originaly, the methods were defined as friends of the template, and it is working fine this way with g++. The methods have been moved outside the namespace util I changed the definition of the templates to fit what I found on various Visual C++ websites. The original friend declaration is: friend QTextStream& operator>>(QTextStream& ss, Vector& in) { ... } The "Visual C++ adapted" version is: friend QTextStream& operator>> <dim,T>(QTextStream& ss, Vector<dim,T>& in); with the function pre-declared before the class and implemented after. I checked the file is correctly included using: #pragma message ("Including vector header") And everything seems fine. Doesn anyone has any idea what might be wrong?

    Read the article

  • "Automatic" class proxy in C++

    - by PierreBdR
    I need to allow the user to change members of two data structures of the same type at the same time. For example: struct Foo { int a, b; } Foo a1 = {1,2}, a2 = {3,4}; dual(a1,a2)->a = 5; // Now a1 = {5,2} and a2 = {5,2} I have a class that works and that change first a1 and then copy a1 into a2. This is fine as long as: the class copied is small the user doesn't mind about everything being copied, not only the part modified. Is there a way to obtain this behavior: dual(a1,a2)->a = 5; // Now a1 = {5,2} and a2 = {5,4} I am opened to alternative syntax, but they should stay simple, and I would like to avoid things like: set_members(a1, a2, &Foo::a, 5); members(a1, a2, &Foo::a) = 5; or anything involving specifying explictely &Foo::

    Read the article

  • Partially parse C++ for a domain-specific language

    - by PierreBdR
    I would like to create a domain specific language as an augmented-C++ language. I will need mostly two types of contructs: Top-level constructs for specialized types or declarations In-code constructs, i.e. to add primitives to make functions calls or idiom easier The language will be used for scientific computing purposes, and will ultimately be translated into plain C++. C++ has been chosen as it seems to offer a good compromise between: ease of use, efficiency and availability of a wide range of libraries. A previous attempt using flex and bison failed due to the complexity of the C++ syntax. The existing parser can still fail on some constructs. So we want to start over, but on better bases. Do you know about similar projects? And if you attempted to do so, what tools would you use? What would be the main pitfalls? Would you have recommendations in term of syntax?

    Read the article

1