The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => The Orphanage => Topic started by: Xor Stance on March 18, 2005, 05:48:54 PM

Title: Jibz, Vortex and Pelles: C++ Syntax
Post by: Xor Stance on March 18, 2005, 05:48:54 PM
Hi, I founded that in the new version of C++. .h are remove, but the thing is that I disagree with:

delete [] arry

Why shouldn't they only use delete array?

char *strcat ( char *dest, const char *src );

stringcat? what does it has to do with C++ programming?

After I learn C++, I'm going to a specific place, so Bjarne Stroustrup can listen: for the next version of C++.

Do you guys disklike the syntax too?



Title: Re: Jibz, Vortex and Pelles: C++ Syntax
Post by: lifewire on March 18, 2005, 06:52:33 PM
altough i'm not in the list, i'm feeling free enough to reply though: which "new version of c++" are you talking about? as far as i know is c++ not changed for decades (oh well, almost). removing .h files? are you talking about c# perhaps?

delete [] array doesn't work, it is delete[] array. it has to do with destructors of objects in the array and such. probably you don't want to know it.
stringcat concatenates two strings. quite uesful.

and i guess there won't be a new version of c++ at all.
Title: Re: Jibz, Vortex and Pelles: C++ Syntax
Post by: Xor Stance on March 18, 2005, 07:27:09 PM
Is not delete array[] it's delete arry[] check this page

http://www.cprogramming.com/tutorial/lesson9.html

What I hate is that cat, I don't know where did they got smoker programmers somewhere, but I guess it must switch like; strdbl: string double.
Title: Re: Jibz, Vortex and Pelles: C++ Syntax
Post by: hitchhikr on March 18, 2005, 08:50:00 PM
delete [] is be used to free the memory allocated for an array with new []

like in:


// Alloc an array of 10 integers
int *anarray = new int[10];

// Discard the allocated memory
delete[] anarray;


it's the same (or almost) as the C code:


// Alloc an array of 10 integers
int *anarray = (int *) malloc(10 * 4);

// Discard the allocated memory
free(anarray);

Title: Re: Jibz, Vortex and Pelles: C++ Syntax
Post by: Jibz on March 18, 2005, 10:37:52 PM
Xor Stance,

The .h extension was removed from the C++ library header files during the standadization process, probably mainly because the std namespace was added. While some compilers still support the old .h versions of the C++ include files for compatibility, you shouldn't use them anymore.

C++ is evolving .. the latest standard is from 2003, but hardly any compilers implement all of it yet.

Quotestringcat? what does it has to do with C++ programming?

strcat is a function from the C standard library, which is therefore also available in C++. The lesson you've reached is explaining how to use C-style strings from C++.

For some odd reason there doesn't seem to be a tutorial on C++ strings there.

QuoteIs not delete array[] it's delete arry[] check this page

arry is just a variable name that the author of that tutorial (for some reason) chose.

You can find the reason for the [] in delete[] in most C++ books, basically the compiler may not know if a pointer points to a single object or an array of objects.
Title: Re: Jibz, Vortex and Pelles: C++ Syntax
Post by: Xor Stance on March 18, 2005, 11:04:27 PM
Thanks, if I ever in future check the "strcat" to change C libraries if possible or just built another version. It will take lot of effort and experience to convince other programmers, C hasn't change for years if it ever a new kind of structures to implement if I ever have the time, plus the C startup model and other misc things :bdg, I don't want to be consider traitor to raise another language. :green
Title: Re: Jibz, Vortex and Pelles: C++ Syntax
Post by: sluggy on March 21, 2005, 01:28:12 PM
Char,
You should master a language before you start trying to convince other programmers that the language needs changing. If you spent as much time studying as you do talking crap, you would be a genius by now. You show your lack of knowledge every time you open your mouth, and everyone's patience is starting to wear a little thin.

Next time you want to discuss something, make sure your argument is well thought out, structured, lucid, logical and factual.