built-in-types

Default construction of elements in a vector

While reading the answers to this question I got a doubt regarding the default construction of the objects in the vector. To test it I wrote the following test code: struct Test { int m_n; Test(); Test(const Test& t); Test& operator=(const Test& t); }; Test::Test() : m_n(0) { } Test::Test(const Test& t) { m_n =...

c#: copy variable to byte array

Hi How do I copy a double, int, bool or other built-in type to a byte array in C#? I need to do it to use the FileStream.Write() method. ...

Is there a function to check if an object is a builtin data type?

I would like to see if an object is a builtin data type in C# I don't want to check against all of them if possible. That is, I don't want to do this: Object foo = 3; Type type_of_foo = foo.GetType(); if (type_of_foo == typeof(string)) { ... } else if (type_of_foo == typeof(in...

Do types in QT applications for different platforms have similar size?

I created an application for Windows in C++ using QT. If I want to port it to Linux or Mac OS, will sizeof(int) or sizeof(long) change? In other words, do types in QT applications for different platforms have similar size? ...

What is the difference between isinstance('aaa', basestring) and isinstance('aaa', str)?

a='aaaa' print isinstance(a, basestring)#true print isinstance(a, str)#true ...

C++: Does the default constructor initialize built-in types

Does the default constructor (created by the compiler) initialize built-in-types? ...

How to default-initialize local variables of built-in types in C++?

How do I default-initialize a local variable of primitive type in C++? For example if a have a typedef: typedef unsigned char boolean;//that's Microsoft RPC runtime typedef I'd like to change the following line: boolean variable = 0; //initialize to some value to ensure reproduceable behavior retrieveValue( &variable ); // do actual ...