News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Jibz, Vortex and Pelles: C++ Syntax

Started by Xor Stance, March 18, 2005, 05:48:54 PM

Previous topic - Next topic

Xor Stance

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?




lifewire

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.

Xor Stance

#2
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.

hitchhikr

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);


Jibz

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.

Xor Stance

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

sluggy

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.