new

C++ Object without new

Hi, this is a really simple question but I havn't done c++ properly for years and so I'm a little baffled by this. Also, it's not the easiest thing (for me at least) to look up on the internet, not for trying. Why doesn't this use the new keyboard and how does it work? Basically, what's going on here? CPlayer newPlayer = CPlayer(posi...

New not allocating enough memory?

Well, I'm taking packets straight off the wire and extracting TCP streams from them. In the short, this means stripping off the various headers (eg, eth->IP->TCP->stream data). In the function that is called when I've finally gotten through all the headers, I am experiencing a strange error. /*Meta is a pointer to the IP heade...

How can I prevent Perl Moose Read-Only Attributes being set upon a call to new?

I would like to simply declare a read only attribute in Moose that cannot be initialized in a call to new. So after declaring the following: package SOD::KuuAnalyze::ProdId; use Moose; has 'users' => (isa => 'ArrayRef[Str]', is => "ro"); 1; I do not want the following to work: my $prodid = SOD::KuuAnalyze::ProdId->new(users => ["...

How to have line breaks in XML attributes?

I have a attribute called: description and I want to have the following in it with new lines: This is the content description section. Download instruction: This is the contents on how to download contents. Hotline support: This is the hotline for contents. How do I create a new line for it in xml? ...

Is there any reason to choose __new__ over __init__ when defining a metaclass?

I've always set up metaclasses something like this: class SomeMetaClass(type): def __new__(cls, name, bases, dict): #do stuff here But I just came across a metaclass that was defined like this: class SomeMetaClass(type): def __init__(self, name, bases, dict): #do stuff here Is there any reason to prefer one ...

overloading new and delete problem

Hi! I try to follow this article: http://flipcode.com/archives/How%5FTo%5FFind%5FMemory%5FLeaks.shtml to overload my new and delete functions in order to track memory leaks. however - if i try to compile, I get a C2365: "operator new": redefinition; previous definition was a "function" in the file xdebug xdebug gets included in xlo...

What informations to collect during a new release

This is more of a project related query.. What ideally should I ask from a developer when he approaches me to sanction a new release? Are there any ready made formats that you all are following? Like .. List of New Fetures, Upgradations & Bug Fixes | TRAC/BugZilla ticket # Why you feel a New Release is required? List of DB / Table / ...

Will using new (std::nothrow) mask exceptions thrown from a constructor?

Assume the following code: Foo* p = new (std::nothrow) Foo(); 'p' will equal 0 if we are out of heap memory. What happens if we are NOT out of memory but Foo's constructor throws? Will that exception be "masked" by the nothrow version of 'new' and 'p' set to 0?... Or will the exception thrown from Foo's constructor make it out of the...

using delete on pointers passed as function arguments

is it okay( and legal) to delete a pointer that has been passed as a function argument such as this: #include<iostream> class test_class{ public: test_class():h(9){} int h; ~test_class(){std::cout<<"deleted";} }; void delete_test(test_class* pointer_2){ delete pointer_2; } int main(){ test_class* pointer_1; w...

Is there anything better than CORBA for interlanguage program communication?

I'm on a project using CORBA to read the data of objects that could be implemented in C++ or Java but conform to the same IDL. The pros are the idlj compiler and all the necessary code came free with Java. The con seems to be that I hear quite a bit that CORBA is old and not the latest and greatest. But I haven't heard names for anything...

How do I over-allocate memory using new to allocate variables within a struct?

So I have a couple of structs... struct myBaseStruct { }; struct myDerivedStruct : public myBaseStruct { int a, b, c, d; unsigned char* ident; }; myDerivedStruct* pNewStruct; ...and I want to dynamically allocate enough space so that I can 'memcpy' in some data, including a zero-terminated string. The size of the base struct...

How to write a text file in C#

I need to write a strings into a text file from C#, each string on a new line...How can I do this? ...

Can I detect whether I've been given a new object as a parameter?

Short Version For those who don't have the time to read my reasoning for this question below: Is there any way to enforce a policy of "new objects only" or "existing objects only" for a method's parameters? Long Version There are plenty of methods which take objects as parameters, and it doesn't matter whether the method has the obje...

open a new window with post values enhancements

var projectWindow; function btnNew_Click() { var form = document.createElement("form"); form.setAttribute("target", "projectWindow"); form.setAttribute("method", "post"); form.setAttribute("action", "MySite.aspx"); document.body.appendChild(form); var hiddenField = document.create...

CMS[CONTENT MANAGEMENT SYSTEM]

how many days it will take to create new content management system . my boss is asking me to develop a own new content management system[CMS] with in one month. i am the only PHP developer i a company . what are the programs to develop new cms. is their any possivle ways to develop a cms in a month. ...

is there a difference between malloced arrays and newed arrays

I'm normally programming in c++, but are using some clibrary functions for my char*. Some of the manpages like for 'getline', says that input should be a malloced array. Is it ok, to use 'new' instead? I can see for my small sample that it works, but could this at some point result in some strange undefined behavior? I know that a 'n...

Removing the need for "new"

A nasty gotcha in javascript is forgetting to call new on a function meant to be instantiated, leading to this being bound to a different object (usually the global) instead of a fresh one. One workaround I read about is to check for it explicitly in the function-constructor using the following idiom: function SomeConstructor(x, y, ...)...

What values can a constructor return to avoid returning this?

What are the exact circumstances for which a return statement in Javascript can return a value other than this when a constructor is invoked using the new keyword? Example: function Foo () { return something; } var foo = new Foo (); If I'm not mistaken, if something is a non-function primitive, this will be returned. Otherwise som...

HTML CSS How to stop a table to put the content after it on a new line?

I have a table followed by an anchor tag. I want the anchor tag not to move to next line after the table. What are the options? ...

not able to add to array (need to use new keyword) in vb.net

I have a property which is an array of items but when I come to add an item to the array it says I must use the new keyword, but I can't use a new keyboard with a property. (item is a custom class) Private itemsvalue As item() Public Property Items() As item() Get Return itemsvalue End Get Set(ByVal value As DBPFind...