new

When to use Malloc instead of New

Duplicate of: In what cases do I use malloc vs new? Just re-reading this question: http://stackoverflow.com/questions/807939/what-is-the-difference-between-new-and-malloc-and-calloc-in-c-closed I checked the answers but nobody answered the question: When would I use malloc instead of new? There are a couple of reasons (I can think ...

How can I construct an object using an array of values for parameters, rather than listing them out, in JavaScript?

Is this possible? I am creating a single base factory function to drive factories of different types (but have some similarities) and I want to be able to pass arguments as an array to the base factory which then possibly creates an instance of a new object populating the arguments of the constructor of the relevant class via an array. ...

wxWidgets using the 'new' keyword

For wxWidgets, why do you need to say: MyFrame *frame = new MyFrame instead of: MyFrame frame; What's the difference between the two? The second one is nicer to read and easier to use but all examples use the first so I wondered what the reason is. Just to clarify, I know the second version doesn't work, but I'm wondering if there's...

what could be wrong with: char* param= new char[200];

Hi, I'm writing a program in C++ and for some reason I'm getting a segmentation error at the following line: char* param= new char[200]; I've tried different variations and even tried putting before it int* param= new int;//for no reason and the same error occurs. What might I have done to cause this problem? What could possibly ...

What's the differences between VirtualAlloc and HeapAlloc?

There are lots of method to allocate memory in windows enviorment, such as VirtualAlloc/HeapAlloc/malloc/new. Thus , what's the difference among them? ...

Best Language/Tool To Develop GUI on Windows

I reviewed the answers provided to the "GUI Programming APIs" post and wondering if these answers still apply. http://stackoverflow.com/questions/610/gui-programming-apis Specifically from that thread it appears that QT is the one that was most referenced with wxWidgets and Shoes a close second and third. I just wanted to make sure ...

Firefox window.opener issue

"window.opener" works fine in both IE and Firefox as long as 'Open in New Tab' is used from the right-click menu; Error console says "window.opener" is null. Is there any other way the opener can be accessed? Edit: Error console says "window.opener" is null only when "Open in New Tab" is clicked. For all other cases, there is no such er...

Pros and cons of 'new' properties in C# / .Net?

Considering the following sample code: // delivery strategies public abstract class DeliveryStrategy { ... } public class ParcelDelivery : DeliveryStrategy { ... } public class ShippingContainer : DeliveryStrategy { ... } and the following sample Order class: // order (base) class public abstract class Order { private DeliveryStr...

Java static vs regular objects

While working on my previous problem, http://stackoverflow.com/questions/950636/java-jar-class-not-found-exception I noticed something odd. the class that can not be found is referenced from main. Now if i try to create an instance of the class like SysTray tray = new SysTray(); i get a class not found exception when i try to run th...

In Visual Basic, Which of the following allows more than one statement to appear on a single text Line?

Which of the following allows more than one statement to appear on a single text Line? a) Colon ( : ) b) Semicolon ( ; ) c) Space + Underscore ( _ ) d) Underscore + space ( _ ) Thanks :) ...

Launch Internet Explorer 7 in a new process without toolbars

Hi All, I need to run a web application in IE so it at least looks similar to a stand-alone application. I also need to be able to run multiple instances of this web application at the same time in separate sessions. To achieve this look I'd like to always launch Internet Explorer 7 in a new process without toolbars/statusbar from a s...

How to promote a new product/service?

This is often a bit of a problem for lone developers working on a product or a service. How can they get the word out about their product? I recently finished a project of mine and I'm struggling a bit to spread word of it. What do you think is the best way to promote your new product/service? Although this question isn't strictly pro...

Creating arrays on the heap and addressing them with pointers

Hi, I'm having trouble understanding the following bit of code that I was hoping would create an array on the heap and fill it with the characters 9 down to 0 (I know I could just index the array like a normal stack array with [] notation to do this but I'm doing it this way to try to understand pointers in more depth): int *ptrHeapArra...

What is the full list of actions performed by placement new in C++?

In this question creating a factory method when the compiler doesn't support new and placement new is discussed. Obviously some suitable solution could be crafted using malloc() if all necessary steps done by placement new are reproduced in some way. What does placement new do - I'll try to list and hope not to miss anything - except th...

How much memory should you be able to allocate?

Background: I am writing a C++ program working with large amounts of geodata, and wish to load large chunks to process at a single go. I am constrained to working with an app compiled for 32 bit machines. The machine I am testing on is running a 64 bit OS (Windows 7) and has 6 gig of ram. Using MS VS 2008. I have the following code: ...

new on objective-c

I want to do this: [[ClassA new] addObject:[[ClassA new] addObject:[ClassA new]]]; but the compiler returns: "error: invalid use of void expression" Is there a way to do it? like in java: ClassA = new ClassA( new ClassA( new ClassA())); ...

Opening a new query window in management studio with prepared "select * from" text

Hi I edited SQLFile.SQL as "select * from" in order to have a new template when I create a new query. but it seems that still I have a blank window.... what's problem ? ...

New certificate on Squid reverse proxy

I need to create a New certificate on Squid reverse proxy to replace an expired one. Anyone know how? PLEASE???? ...

memory allocation in C++

Is it possible to allocate an arbitrary memory block using the "new" operator? In C I can do it like "void * p = malloc(7);" - this will allocate 7 bytes if memory alignment is set to 1 byte. How to make the same in C++ with the new operator? ...

how am i able to declare an array with variable length determined at runtime in C++??

Hi...Please check this code out it compiles and runs absolutely fine.. The question is that when i started learning c++ (turbo c++) i never was able to declare an array of any type as .. datatype var[variable_set_at_runtime]; and i took it for granted that this cant be possible in latest gcc compilers...but surprisingly this is possib...