new

latest programming tools under construction?

This site has been great for me to learn what's out there for programming tools and libraries. I'm wondering what are some promising tools/libraries/algorithms -- in any areas of programming or software engineering -- that are in alpha or beta right now that I should keep my eyes on when they get released. Some ones that come to mind to...

new 2nd param, c++

in an example i saw this line Thing *pThing = new (getHeap(), getConstraint()) Thing(initval()); There was no explanation, function body or class definition. What does the 2nd parameter mean? ...

Allocating large blocks of memory with new.

I have the need to allocate large blocks of memory with new. I am stuck with using new because I am writing a mock for the producer side of a two part application. The actual producer code is allocating these large blocks and my code has responsibility to delete them (after processing them). Is there a way I can ensure my application i...

Do the parentheses after the type name make a difference with new?

If 'Test' is an ordinary class, is there any difference between: Test* test = new Test; //and Test* test = new Test(); ...

How do I set a flash object to open a url in a new window?

Hi Guys, I have this code: <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="300" height="250"> <param name="movie" value="Spotify_premium_300x250.swf" /> <param name="quality" value="high" /> <embed src="Spotify_pre...

When should I use the new keyword in C++?

I've been using C++ for a short while, and I've been wondering about the new keyword. Simply, should I be using it, or not? 1) With the new keyword... MyClass* myClass = new MyClass(); myClass->MyField = "Hello world!"; 2) Without the new keyword... MyClass myClass; myClass.MyField = "Hello world!"; From an implementation perspect...

Why is there a special new and delete for arrays?

What is wrong with using delete instead of delete[]? Is there something special happening under the covers for allocating and freeing arrays? Why would it be different from malloc and free? ...

Getting Onboard The OpenSource Train

I know how to find open source projects. I know how to find them. What I don't know how to do is ask for a list of things to do. Every dev mailing list I have been on has been full of actual developers. I never see any newer programmers present. Most open source projects do not seem new programmer friendly at all. How would someone who...

What is the point of "static new" modifier for a function?

Today, I found something in legacy code. It has "static new" for one function. It looks like this. class Foo { public static void Do() { Console.WriteLine("Foo.Do"); } } class Bar: Foo { public static new void Do() { Console.WriteLine("Bar.Do"); } } I don't understand the static new modifier fo...

When to use "new" and when not to, in C++?

Possible Duplicate: When should I use the new keyword in C++? When should I use the "new" operator in C++? I'm coming from C#/Java background and instantiating objects is confusing for me. If I've created a simple class called "Point", when I create a point should I: Point p1 = Point(0,0); or Point* p1 = new Point(0, 0);...

How does delete[] know it's an array? (C++)

Alright, I think we all agree that what happens with the following code is undefined, depending on what is passed void deleteForMe(int* pointer) { delete[] pointer; } The pointer could be all sorts of different things, and so performing an unconditional delete[] on it is undefined. However, let's assume that we are indeed passing...

Must new always be followed by delete? (C++)

Duplicate of: Is there a reason to call delete in C++ when a program is exiting anyway? I think we all understand the necessity of delete when reassigning a dynamically-allocated pointer in order to prevent memory leaks. However, I'm curious, to what extent does the C++ mandate the usage of delete? For example, take the following progra...

Issues with C++ 'new' operator?

I've recently come across this rant. I don't quite understand a few of the points mentioned in the article: The author mentions the small annoyance of delete vs delete[], but seems to argue that it is actually necessary (for the compiler), without ever offering a solution. Did I miss something? In the section 'Specialized allocators',...

Create Vista User Account Question...

Hello, I am trying to find out how I can programmatically create a logon account in Windows Vista with UAC enabled? I have an OCX that creates a user account and it has worked for years on NT and XP, but now our application fails with Access Denied when creating the account on Vista. If our customers turn off UAC then setup that app i...

C/C++ replacement/redefinition rules?

I am not particularly new to C/C++ but today I discovered some things that I didn't expect. This compiles in gcc: /* test.c */ #include <stddef.h> // ! typedef unsigned long int size_t; // NO ERROR typedef unsigned long int size_t; // NO ERROR int main(void) { typedef unsigned long int size_t; // NO ERROR return 0; } This doesn...

Visual Studio 2005 C++ runtime new exception

I have a VS 2005 C++ project with both Debug and Release builds. I've attempted the following 4 things: Build a Debug executable through Visual Studio, and run it through Visual Studio. Run the executable built in (1) externally via command line (Cygwin) after cd'ing to vstudio/debug. Build a Release executable through Visual Studio, ...

To "new" or not to "new"

Is there a rule of thumb to follow when to use the new keyword and when not to when declaring objects? List<MyCustomClass> listCustClass = GetList(); OR List<MyCustomClass> listCustClass = new List<MyCustomClass>(); listCustClass = GetList(); ...

Is Int32^ i = gcnew Int32() allocated on managed heap?

Basically I would like to know the difference between Int32^ i = gcnew Int32(); and Int32* i2 = new Int32(); I have written the following code: #include <stdio.h> #using <mscorlib.dll> using namespace System; int main(void) { Int32^ i = gcnew Int32(); Int32* i2 = new Int32(); printf("%p %d\n", i2, *i2); pr...

delete[] supplied a modified new-ed pointer. Undefined Behaviour?

I saw some code as below during a peer-code-review session: char *s = new char[3]; *s++ = 'a'; *s++ = 'b'; *s++='\0'; delete []s; // this may or may not crash on some or any day !! Firstly, I know that in Standard C++, pointing to one-past the array-size is O.K. though accessing it results in undefined behaviour. So I b...

Can you inherit a sub new (Constructor) with parameters in VB?

In the code below I recieve the compile error "Error Too many arguments to 'Public Sub New()'" on the "Dim TestChild As ChildClass = New ChildClass("c")". I do not recieve it on "TestChild.Method1()" even though they are both on the base class I am inheriting from. Public Class BaseClass Public ReadOnly Text As String Public Sub...