G
Geoff
Scale everything to mils and work accordingly.
Tell that to Intuit, the largest publisher of financial software on
the PC. They appear to be using float for their currency values.
Scale everything to mils and work accordingly.
All I see is ignorance so far.
jacob navia schreef op 24-Feb-14 4:28 PM:
strcatMany( a, b, c );
jacob said:Le 24/02/2014 12:32, Juha Nieminen a écrit :
In C++ you have to overload the operator << as far as I remember. In C
you have to write a "Print_XXX" function. I do not see why C++ is so
fundamentally better.
But I am afraid you will never be convinced (of course). Do as you wish,
but stop denigrating other computer languages that can be used as
effectively as C++.
Since its birth, C++ tried to be the "better C", "C with classes"
whatever. That is why it is fundamental for them to denigrate C to
convince everyone that C++ is the "better way".
When I try to discuss a package I wrote ( a C containers library) in
comp.lang.c hordes of C++ people go there to "preach the good word" and
tell me that what I did (and run every day) is "impossible, I am lying C
can't do that" etc.
Just stop denigrating C.
No. Scientific notation, like pratically all other text
formats, is base 10. None of the floating point formats I know
of that are in use today are base 10. And the way machine
floating point typically represents the exponent is not
scientific notation either.
Well that is the pointUnintuitive, certainly.
jacob navia schreef op 24-Feb-14 4:28 PM:
strcatMany( a, b, c );
Wouter van Ooijen
PS Jacob, why are you hanging out of a C++ forum?
Le 24/02/2014 16:43, Wouter van Ooijen a écrit :
actually
c = strcatMany(a,b,NULL);
I read it often, I am not a religious person that believes that because
I use (and like) C other languages are all bad. C++ is an interesting
language. What is a pity is that in these forums no real discussion (in
the sense of exchanging arguments, learning from each other's opinion)
seems possible since people here are very "religious" about "their"
language, as you would expect in a political forum.
Yes.What Wouter wrote was to show you that to make a mistake using the
"preferred" form is just as easy as with the other form, and it's just
as _undiagnosable_.
jacob said:My point was that operator overloading is NOT the best paradigm for
output formatting, to come back to the original discussion. The C
paradigm in *that* case is (for the time being) much better.
C gives you a mini-language and a fast run time interpreter for it. This
is a very fast and flexible solution that can be used in the C++
context. It wouldn't be very hard to figure out a standard way of
expanding the mini-language with wild cards that would give it the
possibility of formatting arrays/ new types/ etc.
[..]
Printf extensions have been proposed and implemented. The trio printf
proposed array formatting for instance. Having implemented printf in my
compiler system I find the whole idea simple yet incredibly powerful.
Like the C language. A simple yet powerful language.
It would be more productive for everyone if C++recognized that design
mistake
and would work towards a better implementation of output
formatting (maybe) using that simple idea:
A simple and small formatting LANGUAGE and an associated run time
interpreter.
Thanks for your attention.
What bothers me precisely is this lack of respect from C++ programmers
that believe that because they have mastered some c++ trivialities they
are better than people that do not care about them.
Look at how java programmers are laughed at here. Or Fortran
programmers, or whatever. It is this attitude, this lack of respect that
I question.
The still doesn't address the template case, a topic you appear very
keen to avoid discussing.
How can I express a large value as a double? (e.g. 1000000.3)
Whereas this compiles and executes, when I try to convert it to a
string value it converts as a scientific string (e.g. "1e+006", not
"1000000.3"). I want to process all the characters of the value of the
data as a std::string.
Or is there a way to convert the double to assure it's not expressed
in scientific notation? TIA
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
jacob navia said:For such a SIMPLE thing like outputting text in red we have now to get
into completely unportable stuff. Why?
printf("%__red__bold %s\n","WRONG!");
printf("%__green__italic %s\n", "OK. Let's go on\n");
I suppose you have a point somewhere here. I just can't seem to figure
out what it is.
Le 24/02/2014 15:14, Victor Bazarov a écrit :
I have implemented function overloading in my compiler system lcc-win.
And true, I have read a lot of things about overloading, and also about
how overloading (like anything) can be ABUSED.
For example, the expression
String a,b,c;
c = a+b;
is an *abuse* of overloading.
Why?
Because there is no ADDITION being done when a and b are STRINGS but a
concatenation of two strings, what is *completely different*. If a and b
are strings we have
a+b != b+a
what goes against all the mathematical basis of addition as normal
people use that word.
Dombo said:In many programming languages, including C, one can write: a=a+1;
From the mathematical perspective that is just nonsense.
while(a=a-1)
{
printf("%d", a);
}
Using the mathematical notation semantics statements inside the loop
should never be executed because a never equals a-1
jacob said:Le 24/02/2014 22:57, Ian Collins a écrit :
One way of addressing this is to have a set of elements that represent
the formatting string for each elementary type as in C. (The PRIxXX macros)
Since we have typeof(x) we could also have printtypeof(x) or a similar
construct.
For instance you can write:
printf("The integer is" PRId64 "\n",intvar);
Now, the string behind this macro PRId64 could be then the result of a
computation, i.e. some type-based property that can be determined when
the template is being expanded, a "basic" property that could be further
customized within the intepreter language to have a maximum width, a
"precision" equivalent, whatever.
As with constructors and destructors, each class/struct type can have
easily a printed representation provided by default by the compiler. You
just print the basic types forming the aggregate separated by a single
space. That would be the default printed representation. You can write
your own fancy one as with constructors, copy-constructors, etc.
Note that a default printed representation of a type would go a long way
to easing serialization problems. But this is a disgression.
Of course this is a complex task that shouldn't be done by somebody like
me but by an expert group that pushes the idea of a mini *language* and
a run time interpreter further. The goals could be:
* concise
* extensible
* reasonable defaults for the basic types.
* SIMPLE, not much beyond a sophisticated printf! C++ people have a
tendency to complexify everything until nobody understands anything but
the people that wrote the specs
When defining a class you would add (if you want) a string for the
format interpreter. If you don't the compiler adds the default for the type.
It could be possible also to add other formatting characteristics to the
system since we are no longer in the time of 80 characters green and
black 3270 terminals... Characteristics like colour, bold, italic, for
instance something the C++ system (and the C also) do NOT do today in 2014!
THAT would be a real progress in formatting your output isn't it?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.