where is the ublas::vector push_back ?
hi may i know where is the ublass::vector push_back or what ever does the same ? p.s (i'm not talking about std::vector) ...
hi may i know where is the ublass::vector push_back or what ever does the same ? p.s (i'm not talking about std::vector) ...
int main(void) { char four[4] = "four"; return 0; } When compiled as a C++ program, G++ reports xxx.cpp: In function int main(): xxx.cpp:3: error: initializer-string for array of chars is too long When compiled a a C program, GCC reports no error. It appears to me, that the assignment is correctly copying all 4 bytes into t...
I recently read that Java now sports initialisation blocks like the following: class C { public C() { /* Instance Construction */ } static { /* Static Initialisation */ } { /* Instance Initialisation */ } } I was particularly interested in the static block. It got me thinking about the static initialisation order problem...
Is there any way to do this in a condensed form? GLfloat coordinates[8]; ... coordinates[0] = 1.0f; coordinates[1] = 0.0f; coordinates[2] = 1.0f; coordinates[3] = 1.0f; coordinates[4] = 0.0f; coordinates[5] = 1.0f; coordinates[6] = 0.0f; coordinates[7] = 0.0f; return coordinates; Something like coordinates = {1.0f, ...};? ...
Hello, I'm currently working on a voip project and have a question about the implementation of AES-CBC mode. I know that for instant messaging based on text message communication, it's important to generate an IV for every message to avoid possible guess of the first block if this one is redundant during the communication. But is it us...
Hi, I am not sure about a good way to initialize a shared_ptr that is a member of a class. Can you tell me, whether the way that I choose in C::foo() is fine, or is there a better solution? class A { public: A(); }; class B { public: B(A* pa); }; class C { boost::shared_ptr<A> mA; boost::shared_ptr<B> mB; void...
Based on below, am i right? global_A reference is initialized to null. global_int is 0 local_A reference is null local_int is uninitialized Both global_A.x and local_A.x is uninitialized. THanks for any help. A global_A; int global_int; class A { public : int x; } int main() { int local_int; A local_A; } ...
Hey Guys, in C++ I want to initialize a double matrix (2-dimensional double array) like I would normally do without pointers like so: double data[4][4] = { 1.0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1 }; However, since I want to return and pass it to functions, I need it as a double** pointer. So, basically I need to initia...
I have a class which has a constructor that takes a const char*. It is: c::c(const char* str) { a = 32; f = 0; data = new char[strlen(str)]; memcpy(data, str, strlen(str)); } And a function which takes one of them: int foo(c& cinst); You can call this function either by passing it an instance of a c: c cinst("asdf"...
So this Python problem has been giving me problems since I've tried refactoring the code into different files. I have a file called object.py and in it, the related code is: class Object: #this is a generic object: the player, a monster, an item, the stairs... #it's always represented by a character on screen. def __init__(self, x, y, ...
I'm reading through Mark Dalrymple's Learn Objective-C on the Mac (only at the chapter on Protocols, so still relatively newbish) and trying to figure something out: Why would you ever reference a class by its own name? If I had a class called Foo, why would I ever want to write, say, [[Foo alloc] init] and not [[[self class] alloc...
When you new an object in C# a few things must happen: memory for the object is created, and whatever other book-keeping CLR whats to do fields are initialized to default values the constructor is invoked Serialization frameworks seem to have some magical way to do 1 without doing 2 and 3. Or maybe it's not so magical after all. How ...
Hi, Silly question from a new C programmer... I get a segmentation fault in the following code: #include <stdio.h> int main(void) { double YRaw[4000000]={0}; return 0; } Using GDB, I get the following comment: Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x00007fff5dd7b...
i have a class, in which i am initialising another class that i have made. the other class that i have made has a subclass with only a few changes (none to the init method). What i am wondering is will it be ok if i try to do this. the code looks something like this. in one of the cases: self.shapeLayer = [[UMShapeLayer alloc] init]...
What is the proper way to initialize a null variable in .NET? I've been told by one of my colleagues that hard defining of a variable to null is a slowdown. int var1; // good practice string s1; // good practice int var2 = 0; // bad practice string s2 = null; // bad practice Is that correct? ...
Hi everyone, rookie C++ programmer here still. I'm using VC++ VS2008 compiler and glut library. All working fine and up to date ( I know there's 2010 just cba because of XNA (C#) support reasons) Ok this time I have a question that is code related but I can make the code work. What I can not do is figure out what is happening under th...
To start with I'll say that I agree that goto statements are largely made irrelevant by higher level constructs in modern programming languages and shouldn't be used when a suitable substitute is available. I was re-reading an original edition of Steve McConnell's Code Complete recently and had forgotten about his suggestion for a commo...
I'm programmtically creating websites/users etc ... Here's the problem: When creating a website, I can't immediatly set the config values afterwards. Code: <?php /* Website information */ $website_data = array( 'name' => 'Company name', 'code' => 'website_company_1', 'sort_order' => '1', ...
I have a application.ini like this [production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 includePaths.library = APPLICATION_PATH "/../library" bootstrap.path = APPLICATION_PATH "/Bootstrap.php" bootstrap.class = "Bootstrap" resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" resources.mod...
Essentially, I want to be able to do something like this: struct Foo { const(int)[2] ints; this(int x, int y) { ints = [x, y]; } } but this doesn't work. The compiler (DMD 2.048) just complains that ints isn't mutable. How are you supposed to initialise the array? ...