First  |  Prev |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9 10 11 12
C/C++ query
Initializing an array via a variable is restricted in C++. int a=5; int arr[a];//error I checked it in GNU compilers to my astonishment that this code really works. Also suppose an array is declared to hold 5 data.i.e. int arr[5]; Now, if you try to assign value to array element even greater than 5, t... 6 Aug 2010 06:03
Right Endian conversion
Hi to all, I've written down this function for perfoming endian conversion : template<typename T> T swap_endian(const T& source) { T ret = 0; for (int i = 0; i < sizeof(T); ++i) { *(reinterpret_cast<char*>(&ret) + i) = *(reinterpret_cast<char*>(&source) + sizeof(T) - i - 1); } ... 7 Aug 2010 06:06
a question of style when catching exceptions
I am working on enhancements and changes to a C++ system that uses exceptions. A very common way the code catches exceptions is by the base class, std::exception. I used to think there was nothing wrong with this but my experience with this codebase is making me have second thoughts. When I describe the issues, may... 13 Aug 2010 14:39
Loki::Function
Hi group! I read the FunctionTest.cpp in /test directory and see this: struct X { X(int x); int plus(int x); }; // ... X one(1); Loki::Function<int (int)> f2(&one,&X::plus); It works fine and so I write some similar code for std::vector<int> as follows: vector<int> primTable; Function< ... 5 Aug 2010 23:33
How to implicitily invoke constructor with a single object?
Dear all, In my program there is a constructure declared like: Class Myclass{ public: myclass(int n) { ..... ..... } }; i'm calling my class like following: Class myClass obj(1); obj.DoModel() //DoModel is a MFC/C++ API while debuging this code i got to know that the objct is being initialize twic... 5 Aug 2010 23:33
bind1st makes a copy of its argument
Hi, In the following snippet, for_each(first, last, bind1st(mem_fun_ref(&Foo::fun), arg)); I've found that the GNU implementation of bind1st makes a copy of arg. In my case, arg has a private copy constructor, because it's a heavy operation. On top of that, for_each returns a copy of its third argument rather ... 7 Aug 2010 06:06
[ANN] Free proprietary license for CodeSynthesis XSD and XSD/e
Hi, We have introduced a free proprietary license for CodeSynthesis XSD[1] and XSD/e[2]. The new license allows you to use the generated code to handle small XML vocabularies in proprietary (closed-source) applications free of charge and without having to publish your source code. The license allows you to tar... 3 Aug 2010 18:02
Template type deduction failure when using reference types
Hello all, Can anyone help me with a particularly obscure error? The following code fails to compile on g++ template<typename retT, typename argT> void func(retT (*funcPtr)(argT), argT argument) {} void func1(int a) {} void func2(int& a) {} int main() { int val = 1; int& valref = val; func(&func1... 3 Aug 2010 18:02
Foo a(a); // ?
On 8月3日, 上午6時01分, PGK <graham.k...(a)gmail.com> wrote: Hi all, Why is it that an object can be initialised by itself without error? What is the purpose of such leniency? For example: Foo a(a); // No compile error Cheers, The output of the subsequent code is: Out 1: 7 In 1 : -... 4 Aug 2010 00:36
Foo a(a); // ?
Hi all, Why is it that an object can be initialised by itself without error? What is the purpose of such leniency? For example: Foo a(a); // No compile error Cheers, The output of the subsequent code is: Out 1: 7 In 1 : -1149044056 In 2 : -1149044056 Out 2: 7 ------------------------------------... 3 Aug 2010 09:13
First  |  Prev |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9 10 11 12