initalization

Is there a difference in C++ between copy initialization and assignment initialization?

Suppose I have this function: void my_test() { A a1 = A_factory_func(); A a2(A_factory_func()); double b1 = 0.5; double b2(0.5); A c1; A c2 = A(); A c3(A()); } In each grouping, are these statements identical? Or is there an extra (possible optimizable) copy in some of the initializations? I have seen peo...

F#: I cannot return unit in a do clause and still have side effects

I'm writing a simple ini file parser and I'm having a little problem with the initialization of the object in the "do" clause. It wants me to return a unit but i can't get the blankity function to do the side effects if I try to pipe into an "ignore" or if i return "()" directly. This code works as a separate function because I can igno...

What is going on at the top of this function

I'm currently looking at a function example that I can't seem to figure out using MFC in Visual C++. The function is as follows CMFC_OSG_MDIView::CMFC_OSG_MDIView() :mOSG(0L) { } I understand everything here except the mOSG(0L) snippet. mOSG was declared in the MFC_OSG _MDIView class as follows: cOSG* mOSG; Any help is greatly appr...

C - Array in an array

I want to have a static array with arrays in it. I know you can make a normal array like this: int test[] = {1,2,3,4}; But I want to do something like this (Xcode gives me a bunch of warnings and stuff): int test[] = {{1,2}, {3,4}}; In python it would be: arr = [[1,2], [3,4]]; What's the proper way to do this? ...

How to italicize a word being displayed by a web.sitemap

I have a company name that always needs to be italicized. I have navigation that is driven by my sitemap and I can not figure out how to italicize the word. The word is always the same, so I thought about some Jscript, but was wondering if I had any other options. Thank You. ...

Initializing attributes in Ruby objects

I create a new object of type Spam, with attr_accessor to both hooray and name and I have the initialize method. I'm expecting when I create a new object the object is loaded with a var of name with "Whammy" and a empty array named hooray. Though I'm not getting this behavior. Can anyone explain, thank you in advance. module Test class ...

Static member object initialization failure

I have a static library with the following code: h file: class Foo { public: Foo() { a = 4; } int a; }; class Bar { public: static const Foo foo; }; cpp file: const Bar::foo = Foo(); My problem is that Bar::foo does not get initialized with a=4 until some time after main(). Before then a=0. I'm trying to ...