C++'s memory allocation keyword. <flamebait>Unlike malloc, this is Satan.</flamebait> Used like this:
	SomeClass *foo = new SomeClass( constructor_args );
	char *s = new char[nmemb];

You get the idea...

Note that this is not C. C++ only. See also: delete

No Doubt released New in 1999 as part of the Go soundtrack, and then included it as track #8 on Return of Saturn. I've put the words highlighted in the liner notes in bold (see the Return of Saturn write-up if you don't get that). There is only one line in this song, which is due, (I theorize) to the fact that the song was written before most of the others on ROS, and therefore doesn't contain the same themes as the other songs on the album.

Don't let it go away
This feeling has got to stay
Don't let it go away
This feeling has got to stay
And I can't believe I've had this chance now
Don't let it go away

Chorus:New, you're so new
You, you're new
And I never had this taste in the past
New, you're so new

My normal hesitation is gone
And I really gravitate to your will
Are you here to fetch me out?
'Cause I've never had this taste in my mouth

You're not old
And you're not familiar
Recently discovered and I'm learning about you

New, you're so new
You, you're new

And you're consuming me violently
And your reverence shamelessly tempting me
Who sent this maniac?
'Cause I never had this taste in the past

You're different, you're different from the former
Like a fresh battery I'm energized by you

(chorus)

Why am I so curious?
This territory is dangerous
I'll probably end up at the start
I'll be back in line with my broken heart

New, you're so new
You, you're new
And I never had this taste in the past

(chorus)

And I can't believe it
Can't believe it
Can't believe it
Can't believe it
Don't let it go away, this feeling has got to stay
Don't let it go away

The song was written by Gwen Stefani and Tom Dumont.

new is the C++ keyword used to allocate memory from the freestore. There are a few caveats -
  1. Whenever you allocate some memory in this way, you must delete it with the delete operator. Otherwise you have a memory leak.
  2. Do not deallocate memory allocated with new with free(). The behaviour for this is undefined, so don't do it.
Not that there's anything wrong with using malloc() and free() in C++ programs. You can use both new/delete and malloc()/free() in the same program, just don't mix them up. Also, remember that malloc() will not call the constructor on the object, and free() will not call the destructor.

New and delete are operators, meaning you can overload them.

If memory allocation with new fails, then you can define behaviour for this eventuality. Do so like this -

#include <new>

void OutOfMemory();

void OutOfMemory() {
  cerr [[ "Out of memory!";
  abort();
}

int main() {
  set_new_handler(OutOfMemory);
  HogMemory();
}
The function that controls what happens when you try to allocate memory which doesn't exist needs to be passed to set_new_handler. When new can't allocate any new memory, it calls the new handler repeatedly. Therefore, a new handler must either free more memory, exit the program, throw an exception, or install a new handler that can solve the problem.

Anyway, onto some examples of the usage of new -

int* X = new int; // new int created, pointed to by X
int* Y = new int[10]; // create 10 new ints, pointed to by Y

If you allocate an array with new, then you have to use the delete[] operator to get rid of it, not just plain delete. If you don't, then at best you'll just delete the first element of the array.

New (?), a. [Compar. Newer (?); superl. Newest.] [OE. OE. newe, AS. niwe, neowe; akin to D. nieuw, OS. niwi, OHG. niuwi, G. neu, Icel. nr, Dan. & Sw. ny, Goth. niujis, Lith. naujas, Russ. novuii, Ir. nua, nuadh, Gael. nuadh, W. newydd, Armor. nevez, L. novus, gr. , Skr. nava, and prob. to E. now. 263. See Now, and cf. Announce, Innovate, Neophyte, Novel.]

1.

Having existed, or having been made, but a short time; having originated or occured lately; having recently come into existence, or into one's possession; not early or long in being; of late origin; recent; fresh; modern; -- opposed to old, as, a new coat; a new house; a new book; a new fashion.

"Your new wife."

Chaucer.

2.

Not before seen or known, although existing before; lately manifested; recently discovered; as, a new metal; a new planet; new scenes.

3.

Newly beginning or recurring; starting anew; now commencing; different from has been; as, a new year; a new course or direction.

4.

As if lately begun or made; having the state or quality of original freshness; also, changed for the better; renovated; unworn; untried; unspent; as, rest and travel made him a new man.

Steadfasty purposing to lead a new life. Bk. of Com. Prayer.

Men after long emaciating diets, fat, and almost new. Bacon.

5.

Not of ancient extraction, or of a family of ancient descent; not previously kniwn or famous.

Addison.

6.

Not habituated; not familiar; unaccustomed.

New to the plow, unpracticed in the trace. Pope.

7.

Fresh from anything; newly come.

New from her sickness to that northern air. Dryden.

New birth. See under Birth. -- New Church, ∨ New Jerusalem Church, the church holding the doctrines taught by Emanuel Swedenborg. See Swedenborgian. -- New heart Theol., a heart or character changed by the power of God, so as to be governed by new and holy motives. -- New land, land ckeared and cultivated for the first time. -- New light. Zool. See Crappie. -- New moon. (a) The moon in its first quarter, or when it first appears after being invisible. (b) The day when the new moon is first seen; the first day of the lunar month, which was a holy day among the Jews. 2 Kings iv. 23. -- New Red Sandstone Geol., an old name for the formation immediately above the coal measures or strata, now divided into the Permian and Trias. See Sandstone. -- New style. See Style. -- New testament. See under Testament. -- New world, the land of the Western Hemisphere; -- so called because not known to the inhabitants of the Eastern Hemisphere until recent times.

Syn. -- Novel; recent; fresh; modern. See Novel.

 

© Webster 1913.


New (?), adv.

Newly; recently.

Chaucer.

New is much used in composition, adverbially, in the sense of newly, recently, to quality other words, as in new-born, new-formed, new-found, new-mown.

Of new, anew. [Obs.]

Chaucer.

 

© Webster 1913.


New, v. t. & i.

To make new; to renew.

[Obs.]

 

© Webster 1913.

Log in or registerto write something here or to contact authors.