Edited again because it originally wasn't clear that I'm trying to initialize the arrays at compile time, not at run time...
I've got the following reduced testcase:
typedef struct TestStruct
{
int length;
int values[];
};
TestStruct t = {3, {0, 1, 2}};
TestStruct t2 = {4, {0, 1, 2, 3}};
int main()
{
return(0);
}
This...
hi, very short question.
Is C++ typeof operator standard? de facto standard?
which compilers do not provided it (besides Microsoft C++)?
...
why RTTI is necessary
...
I have two functions:
1. A & DataSource();
2. void DataConsumer( A * );
What I want to achieve: Using one statement to assemble them into one functor.
I have tried:
1. boost::function< void()> func( boost::bind( DataConsumer, & boost::bind( DataSource ) ) );
certainly it didn't work, compiler says it can not convert 'boost::_bi::bind...
Hello, as a way to spice up my C++ programming homework, I've decided to instead of typing the C++ from the book onto my computer, instead reforming it in Ruby. Yes it's a bit silly, but I'm bored.
Anyway, I'm having trouble converting this kind of function to Ruby
void swap(int &a,int &b){
int c=b;
b=a;
a=c
}
What would be th...
int main() {
B bb; //does not compile (neither does class B bb;)
C cc; //does not compile
struct t tt; //compiles
class B {}; //HERE is the class B defination
struct s { struct t * pt; }; //compiles
struct t { struct s ...
Suppose I have a list of #defines in a header file for an external library. These #defines represent error codes returned from functions. I want to write a conversion function that can take as an input an error code and return as an output a string literal representing the actual #define name.
As an example, if I have
#define NO_ERROR ...
I am writing a Win32 DLL library that can be redistributed. I am using different versions of the windows API because I want to support Windows 7 functions, but still have support for Windows 2000 (with some function disabled). What I have currently is MyLib2000.dll, MyLibXP.dll, and MyLibVista.dll, and my application chooses which librar...
I'm a bit fuzzy on the basic ways in which programmers code differently in C and C++. One thing in particular is the usage of strings in C++ over char arrays, or vice versa. So, should I use strings or char arrays, in general, and why?
...
hi,
i am very new to c++. i am getting system crash (not compilation error) in doing following:
i am declaring global pointer of class.
BGiftConfigFile *bgiftConfig;
class BGiftConfigFile : public EftBarclaysGiftConfig { }
in this class i am reading tags from xml file. it is crashing system when this pointer is used to retrieve va...
I'm getting a link time error:
WARNING: /home/gulevich/development/camac-fedorov/camac/linux/k0607-lsi6/camac-k0607-lsi6.o (.ctors): unexpected non-allocatable section.
Did you forget to use "ax"/"aw" in a .S file?
Note that for example <linux/init.h> contains
section definitions for use in .S files.
The code causing the error (assemb...
Hi, I am looking for a RPC stack that can be used between a Java Server and C++ clients.
My requirements are:
Ease of integration (for both C++ and Java)
Performance, especially number of concurrent connections and response time. Payload are mostly binaries (8-100kb)
I found some like:
http://code.google.com/p/protobuf-socket-rpc...
hello there, I have the following class
#ifndef Container_H
#define Container_H
#include <iostream>
using namespace std;
class Container{
friend bool operator==(const Container &rhs,const Container &lhs);
public:
void display(ostream & out) const;
private:
int sizeC; // size of Container
int capacityC; ...
Hi,
does anybody know of a library for storing data securely in an 8k-EEPROM, which is attached over the I2C-interface? I am especially interested in wear-leveling as I have a write-intensive application where the EEPROM should/must be used as a NVRAM for often-chaning measurement data.
Thanks in advance, Martin
...
Hi,
In one of my projects, I have some classes that represent entities that cannot change once created, aka. immutable classes.
Example : A class RSAKey that represent a RSA key which only has const methods. There is no point changing the existing instance: if you need another one, you just create one.
My objects sometimes are heavy a...
My .ocx contains two ActiveX controls and I use both of them on one page.
When user comes to page he gets two install confirmations for the same binary. After the first installation and page reload he gets one control displayed and “the website wants to run the following add-on...” yellow bar with control’s run confirmation for the oth...
Hi,
Let's say I have two classes, A and B, where B is a child class of A.
I also have the following function:
void foo(boost::shared_ptr<const A> a)
{
boost::shared_ptr<const B> b = boost::dynamic_pointer_cast<const B>(a); // Error !
}
Compilation with gcc gives me the following errors:
C:\Boost\include/boost/smart_ptr/shared_p...
Hi,
I have a list of Point objects, (each one with x,y properties) and would like to find the left-most and right-most points. I've been trying to do it with find_if, but i'm not sure its the way to go, because i can't seem to pass a comparator instance. Is find_if the way to go? Seems not. So, is there an algorithm in <algorithm> to ac...
EDIT:
In the following code container::push takes an object of type T that derives from base as argument and stores in a vector a pointer to the method bool T::test().
container::call calls each of the stored methods in the context of to the member object p, which has type base, not T. It works as long as the called method does not ref...
As the title says, the java.io.tmpdir property in Java is really nice, and I can't find an equivalent for C. I'm writing for Windows and in Visual Studio. I don't want to just use something like C:\Temp because in later versions of windows the appropriate directory could be something like C:\Users\[UserName]\AppData\Local\Temp and a way ...