G
Grizlyk
peter said:You use the standard elements available, e.g. std::string. This is
very good advice.
The good advice has no provements. Any simple thing is always better
than complex one. What is the problems with strXXX in the concrete
context? Nothing. The code in not intended to be reused, never.
No. The program is "stupid" because it does not use
what is available
I think i answered on the question below:
So, we will see your opinion on the idea below.
but insists on using elements of a coding style
that were meant for more low-level programming.
It is freedom, to be without strange limitations .
I am not going to spend my time determining
what your code is supposed to do, but a glimpse
shows that your code is basically C
Who is the grave "glimpse", that can not see templates, namespaces and
tons of C++ code ? He is wrong.
The template is an attempt to have a "smart" pointer to some
storage perhaps?
The concrete listed template is intended to be storage for all dynamic
C-style arrays, that required inside of any block scope. The template
is owner of memory of the arrays and makes all that neccesery to
correctly return unused memory into system back.
The template has only free-stating methods, so implementation of the
template has not more overhead than ordinary POD pointer.
I am afraid I fail to see the purpose of that class.
This is very useful thing, if you need C-style array with unknown for
compile time size of the array, for non-intrusive, dynamic arrays
allocated by new[].
Did you measure your perceived loss?
Sorry, It was question for which I was going to answer myself: "what
kind of replacement _could_ be done...". No, i did not measure
anything, but saw assempler output.
I agree.A SIG is not a C++ exception.
Do not transform hardware exceptions into C++ exceptions.
I guess, you advise to do not throw from signal handler, probably? I
agree. To deliver SIGxxx to signal handler environment of executable
do some thing, that outside of C++ scope, but not prohibited by C++ to
catch excepion inside of strcpy.
At any rate, is does not matter, who can throw inside of strcpy, but
the code is ready to catch the possible exception and return the
unused memory into system back.
The details with delete/delete[] look like
variable without type.
The point is that new[] is a "low-level" detail, practically never
needed in a C++ program.
All depends from target, but if "new[]" is not prohibited, it must
work correctly. I hope, that for C++ "correct work" will be selected
instead of attacks again "new[]".
I do not know what DTA is
DTA is a raw memory area for transfer data over any boundaries or used
for temporary storage.
but if you can use operator new you can also
use std::vector.
But i am not goint do use no one member of class vector<>, and the
You did show that yourself, I believe having three errors in a 20
lines of code because you refused to use the standard library and
insisted on using lower level tools that you did not understand.
And what _exactly_ i do not understand in the concrete low level
tools? I see, you want to say, that all errors in C++ produced only by
human, in spite of compiler bring all forces to help him?
And your advice looks like you believe, that if i want to use any part
of C++, but i am not sure do i understand or do not what i am going to
do, i must select the standard library, doesn't it? Or what?
The question was: are you allowing use of other parts of language, and
if yes, why they can not be done also safe, as your lovely standard
library - is only true way to the future?
You can express multiplication by using addition
and a for loop, but doing so would be silly.
I do not understand, i did not use "addition and for loop". What is
concrete problem in my example without unused parts (excluding errors
already detected by me).
I am not sure I understand you here, but the C++ standard
library is very much a part of the C++ language.
All is quite clear. Type "int" is a part of language, but function
"printf" is not. The "printf" is member of a ordinary library, but the
library is standard, so you can think, that the library will exist and
your code will be portable and understandable for other readers.
Maksim A. Polyanin
old page about some C++ improvements:
http://grizlyk1.narod.ru/cpp_new