29 2872
Ioannis Vranos wrote:
Dexter wrote:
>This Java based utility may be invoked from Java code to parse mathematical expressions. It is useful for programmers developing calculators, graphing utilities or other math related programs.
Download for free at http://www.thinkanddone.com/prog/java/parser.html
If the above link does not work try http://www.britishcomputercolleges.c...a/parser2.html
An interview of the inventor of C++ templates, Alexander Stepanov, where
it mentions Java:
<EvenMoreOT>He didn't invent templates, he was the authour of the
Standard Template Library</EvenMoreOT>
What has this to do with C anyway?
--
Ian Collins.
Ian Collins wrote:
Ioannis Vranos wrote:
>Dexter wrote:
>>This Java based utility may be invoked from Java code to parse mathematical expressions. It is useful for programmers developing calculators, graphing utilities or other math related programs.
Download for free at http://www.thinkanddone.com/prog/java/parser.html
If the above link does not work try http://www.britishcomputercolleges.c...a/parser2.html An interview of the inventor of C++ templates, Alexander Stepanov, where it mentions Java:
<EvenMoreOT>He didn't invent templates, he was the authour of the
Standard Template Library</EvenMoreOT>
AFAIK he invented templates.
What has this to do with C anyway?
Nothing right now. However I think template functions and structs could
be introduced in C.
Ioannis Vranos <iv*****@nospam.no.spamfreemail.grwrites:
I think template functions and structs could be introduced in
C.
You can already use them in C++. There is no need for them in C.
--
Ben Pfaff http://benpfaff.org
Ben Pfaff wrote:
Ioannis Vranos <iv*****@nospam.no.spamfreemail.grwrites:
>I think template functions and structs could be introduced in C.
You can already use them in C++. There is no need for them in C.
So, whatever we can use in C++ needs not be provided in C. In other
words you are saying that C is obsolete.
Templates can replace elegantly C's generic programming which is now
done by using void pointers and indentifiers.
Ioannis Vranos wrote:
Ben Pfaff wrote:
>Ioannis Vranos <iv*****@nospam.no.spamfreemail.grwrites:
>>I think template functions and structs could be introduced in C.
You can already use them in C++. There is no need for them in C.
So, whatever we can use in C++ needs not be provided in C. In other
words you are saying that C is obsolete.
Templates can replace elegantly C's generic programming which is now
done by using void pointers and indentifiers.
King 'ell not again!
You could say that any C++ feature would enhance C, when all you would
end up with is an early C++ compiler and you know where they ended up.
Templates lead to function over loading which leads to....
We all have our pet C enhancements, which can be suggested on comp.std.c.
--
Ian Collins.
In article <fr**********@ulysses.noc.ntua.gr>,
Ioannis Vranos <iv*****@nospam.no.spamfreemail.grwrote:
>>I think template functions and structs could be introduced in C.
>You can already use them in C++. There is no need for them in C.
>So, whatever we can use in C++ needs not be provided in C. In other words you are saying that C is obsolete.
Not at all. He's saying there's no point making C be the same
as C++. If you want C++, you know where to find it.
Of course, both positions are too extreme.
-- Richard
--
:wq
Ioannis Vranos wrote:
Ben Pfaff wrote:
>Ioannis Vranos <iv*****@nospam.no.spamfreemail.grwrites:
>>I think template functions and structs could be introduced in C.
You can already use them in C++. There is no need for them in C.
So, whatever we can use in C++ needs not be provided in C. In
other words you are saying that C is obsolete.
Don't be silly. You select a language to suit the job. If you
really need template functions use C++ or better languages (Ada,
for example). You probably don't need them.
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
--
Posted via a free Usenet account from http://www.teranews.com
Ioannis Vranos wrote:
Ian Collins wrote:
.... snip ...
>> We all have our pet C enhancements, which can be suggested on comp.std.c.
Actually making "versions" inside a generic C function which uses
void pointers, for every type it can accept, I think is usually
more bloated code than providing a simple template function. Also
the template one is faster since it has not those conditional-
specialisations.
You should take this to comp.compilers.lcc and join with Jacob
Navia. There it can be on-topic, and Jacob will agree with you.
Here it is off-topic, and virtually noone will agree with you.
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
--
Posted via a free Usenet account from http://www.teranews.com
CBFalconer wrote:
Ioannis Vranos wrote:
>Ian Collins wrote:
... snip ...
>>> We all have our pet C enhancements, which can be suggested on comp.std.c.
Actually making "versions" inside a generic C function which uses void pointers, for every type it can accept, I think is usually more bloated code than providing a simple template function. Also the template one is faster since it has not those conditional- specialisations.
You should take this to comp.compilers.lcc and join with Jacob
Navia. There it can be on-topic, and Jacob will agree with you.
Here it is off-topic, and virtually noone will agree with you.
He *was* talking about standard C code, essentially saying that
functions accepting void * arguments and including separate code to
deal with all supported argument types is actually more bloated and
slow than code derived through some form of generics.
In pure C the closest one can come to type generic source code is
through the macro processor.
Ioannis Vranos said:
Ben Pfaff wrote:
>Ioannis Vranos <iv*****@nospam.no.spamfreemail.grwrites:
>>I think template functions and structs could be introduced in C.
You can already use them in C++. There is no need for them in C.
So, whatever we can use in C++ needs not be provided in C. In other
words you are saying that C is obsolete.
CUSTOMER: "I'd like a knife and fork, please."
WAITER: "Here you are, sir."
CUSTOMER: "Wait a moment - this fork has no sharp edge."
WAITER: "That's right."
CUSTOMER: "But this knife has a lovely edge on it. Why can't the fork be
like that?"
WAITER: "Because it's a fork."
CUSTOMER: "This knife has serrations along the blade to improve its grip
during the cut. Why can't the fork have serrations?"
WAITER: "Because it's a fork. If you want to cut, use the knife."
CUSTOMER: "So what you're saying is that the fork is useless? I don't need
it?"
WAITER: "No, what I'm saying is that I don't get paid enough to deal with
people like you."
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
CBFalconer wrote:
Ioannis Vranos wrote:
>Ben Pfaff wrote:
>>Ioannis Vranos <iv*****@nospam.no.spamfreemail.grwrites:
I think template functions and structs could be introduced in C. You can already use them in C++. There is no need for them in C.
So, whatever we can use in C++ needs not be provided in C. In other words you are saying that C is obsolete.
Don't be silly. You select a language to suit the job. If you
really need template functions use C++ or better languages (Ada,
for example). You probably don't need them.
How do you know what others need? If nobody needed function templates,
C++ wouldn't have a standard library built around them.
--
Ian Collins.
Ian Collins said:
CBFalconer wrote:
>Ioannis Vranos wrote:
>>Ben Pfaff wrote: Ioannis Vranos <iv*****@nospam.no.spamfreemail.grwrites:
I think template functions and structs could be introduced in C. You can already use them in C++. There is no need for them in C. So, whatever we can use in C++ needs not be provided in C. In other words you are saying that C is obsolete.
Don't be silly. You select a language to suit the job. If you really need template functions use C++ or better languages (Ada, for example). You probably don't need them.
How do you know what others need? If nobody needed function templates,
C++ wouldn't have a standard library built around them.
Nobody needs function templates. All you need is a big old array, ++p, --p,
++*p, --*p, putchar(*p), *p = getchar(), jump from HERE to THERE if *p is
0, and jump back from THERE to HERE. And you probably don't *need* all of
those.
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Richard Heathfield wrote:
Ian Collins said:
>CBFalconer wrote:
>>Ioannis Vranos wrote: Ben Pfaff wrote: Ioannis Vranos <iv*****@nospam.no.spamfreemail.grwrites: > >I think template functions and structs could be introduced in >C. You can already use them in C++. There is no need for them in C. So, whatever we can use in C++ needs not be provided in C. In other words you are saying that C is obsolete. Don't be silly. You select a language to suit the job. If you really need template functions use C++ or better languages (Ada, for example). You probably don't need them.
How do you know what others need? If nobody needed function templates, C++ wouldn't have a standard library built around them.
Nobody needs function templates. All you need is a big old array, ++p, --p,
++*p, --*p, putchar(*p), *p = getchar(), jump from HERE to THERE if *p is
0, and jump back from THERE to HERE. And you probably don't *need* all of
those.
I walked into that one with my eyes open, didn't I?
--
Ian Collins.
"Richard Heathfield" <rj*@see.sig.invalidwrote in message
news:yO******************************@bt.com...
Ioannis Vranos said:
>Ben Pfaff wrote:
>>Ioannis Vranos <iv*****@nospam.no.spamfreemail.grwrites:
I think template functions and structs could be introduced in C.
You can already use them in C++. There is no need for them in C.
So, whatever we can use in C++ needs not be provided in C. In other words you are saying that C is obsolete.
CUSTOMER: "I'd like a knife and fork, please."
WAITER: "Here you are, sir."
CUSTOMER: "Wait a moment - this fork has no sharp edge."
WAITER: "That's right."
CUSTOMER: "But this knife has a lovely edge on it. Why can't the fork be
like that?"
WAITER: "Because it's a fork."
CUSTOMER: "This knife has serrations along the blade to improve its grip
during the cut. Why can't the fork have serrations?"
WAITER: "Because it's a fork. If you want to cut, use the knife."
CUSTOMER: "So what you're saying is that the fork is useless? I don't need
it?"
WAITER: "No, what I'm saying is that I don't get paid enough to deal with
people like you."
LOL. :^D
CBFalconer wrote:
>
You should take this to comp.compilers.lcc and join with Jacob
Navia. There it can be on-topic, and Jacob will agree with you.
Here it is off-topic, and virtually noone will agree with you.
I suppose you know what templates are. If you do, I suppose you consider
having complex numbers and rest of area-specific stuff built in better
than having useful general purpose facilities built in.
Ioannis Vranos wrote:
CBFalconer wrote:
>> You should take this to comp.compilers.lcc and join with Jacob Navia. There it can be on-topic, and Jacob will agree with you. Here it is off-topic, and virtually noone will agree with you.
I suppose you know what templates are. If you do, I suppose you consider
having complex numbers and rest of area-specific stuff built in better
than having useful general purpose facilities built in.
Falconer is the resident troll.
Just ignore him
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique http://www.cs.virginia.edu/~lcc-win32
Ian Collins wrote:
CBFalconer wrote:
>Ioannis Vranos wrote:
>>Ben Pfaff wrote: Ioannis Vranos <iv*****@nospam.no.spamfreemail.grwrites:
I think template functions and structs could be introduced in C.
You can already use them in C++. There is no need for them in C.
So, whatever we can use in C++ needs not be provided in C. In other words you are saying that C is obsolete.
Don't be silly. You select a language to suit the job. If you really need template functions use C++ or better languages (Ada, for example). You probably don't need them.
How do you know what others need? If nobody needed function
templates, C++ wouldn't have a standard library built around them.
Read it again. I didn't claim to know what others need. I said
"If you need them then ...". I said "probably don't". It is also
a fact that they don't exist in C, and are thus off topic here.
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
--
Posted via a free Usenet account from http://www.teranews.com
Richard Heathfield wrote:
Ioannis Vranos said:
>Ben Pfaff wrote:
>>Ioannis Vranos <iv*****@nospam.no.spamfreemail.grwrites:
I think template functions and structs could be introduced in C. You can already use them in C++. There is no need for them in C.
So, whatever we can use in C++ needs not be provided in C. In other words you are saying that C is obsolete.
CUSTOMER: "I'd like a knife and fork, please."
WAITER: "Here you are, sir."
CUSTOMER: "Wait a moment - this fork has no sharp edge."
WAITER: "That's right."
CUSTOMER: "But this knife has a lovely edge on it. Why can't the fork be
like that?"
WAITER: "Because it's a fork."
CUSTOMER: "This knife has serrations along the blade to improve its grip
during the cut. Why can't the fork have serrations?"
WAITER: "Because it's a fork. If you want to cut, use the knife."
CUSTOMER: "So what you're saying is that the fork is useless? I don't need
it?"
WAITER: "No, what I'm saying is that I don't get paid enough to deal with
people like you."
Priceless.
--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Richard Heathfield wrote:
Ioannis Vranos said:
>Ben Pfaff wrote:
>>Ioannis Vranos <iv*****@nospam.no.spamfreemail.grwrites:
I think template functions and structs could be introduced in C. You can already use them in C++. There is no need for them in C.
So, whatever we can use in C++ needs not be provided in C. In other words you are saying that C is obsolete.
CUSTOMER: "I'd like a knife and fork, please."
WAITER: "Here you are, sir."
CUSTOMER: "Wait a moment - this fork has no sharp edge."
WAITER: "That's right."
CUSTOMER: "But this knife has a lovely edge on it. Why can't the fork be
like that?"
WAITER: "Because it's a fork."
CUSTOMER: "This knife has serrations along the blade to improve its grip
during the cut. Why can't the fork have serrations?"
WAITER: "Because it's a fork. If you want to cut, use the knife."
CUSTOMER: "So what you're saying is that the fork is useless? I don't need
it?"
WAITER: "No, what I'm saying is that I don't get paid enough to deal with
people like you."
This fictional conversation has nothing to do with the value of
function/struct templates in terms of *elegance (simplicity)*,
*efficiency*, *type safety* as a newer and better tool, replacing
generic functions currently implemented with void * and conditions, and
macros.
As an example of C++ features adoption, consider function-prototypes
adopted and provided in C89 as well as other features I do not remember now.
Ioannis Vranos wrote:
>
.... snip ...
>
This fictional conversation has nothing to do with the value of
function/struct templates in terms of *elegance (simplicity)*,
*efficiency*, *type safety* as a newer and better tool, replacing
generic functions currently implemented with void * and conditions,
and macros.
As an example of C++ features adoption, consider function-prototypes
adopted and provided in C89 as well as other features I do not
remember now.
So? I think the point is that function/struct templates are a C++
feature, and discussion belongs in c.l.c++, not here. In c.l.c it
is off-topic.
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
--
Posted via a free Usenet account from http://www.teranews.com
On Mar 20, 6:11*pm, Ioannis Vranos <ivra...@nospam.no.spamfreemail.gr>
wrote:
Ian Collins wrote:
(...)
What has this to do with C anyway?
Nothing right now. However I think template functions and structs could
be introduced in C.
If you have a figured out a way to introduce templates in C without
breaking its linkage specification and without introducing horrible
kludges in its grammar, am sure you will find people interested in
listening to you.
- Anand
CBFalconer wrote:
Ioannis Vranos wrote:
>>
... snip ...
>> This fictional conversation has nothing to do with the value of function/struct templates in terms of *elegance (simplicity)*, *efficiency*, *type safety* as a newer and better tool, replacing generic functions currently implemented with void * and conditions, and macros.
As an example of C++ features adoption, consider function-prototypes adopted and provided in C89 as well as other features I do not remember now.
So? I think the point is that function/struct templates are a C++
feature, and discussion belongs in c.l.c++, not here. In c.l.c it
is off-topic.
If Ioannis is serious about the possibility of some type of generics in
future C then he could start a discussion in comp.std.c, where it would
be topical as a proposed extension, but he might need to think this out
far more rigorously is that case.
On Mar 21, 9:24*am, Ioannis Vranos <ivra...@nospam.no.spamfreemail.gr>
wrote:
Richard Heathfield wrote:
Ioannis Vranos said:
Ben Pfaff wrote: Ioannis Vranos <ivra...@nospam.no.spamfreemail.grwrites:
>>I think template functions and structs could be introduced in C. You can already use them in C++. *There is no need for them in C.
So, whatever we can use in C++ needs not be provided in C. In other
words you are saying that C is obsolete.
CUSTOMER: "I'd like a knife and fork, please."
WAITER: "Here you are, sir."
CUSTOMER: "Wait a moment - this fork has no sharp edge."
WAITER: "That's right."
CUSTOMER: "But this knife has a lovely edge on it. Why can't the fork be
like that?"
WAITER: "Because it's a fork."
CUSTOMER: "This knife has serrations along the blade to improve its grip
during the cut. Why can't the fork have serrations?"
WAITER: "Because it's a fork. If you want to cut, use the knife."
CUSTOMER: "So what you're saying is that the fork is useless? I don't need
it?"
WAITER: "No, what I'm saying is that I don't get paid enough to deal with
people like you."
This fictional conversation has nothing to do with the value of
function/struct templates in terms of *elegance (simplicity)*,
*efficiency*, *type safety* as a newer and better tool, replacing
generic functions currently implemented with void * and conditions, and
macros.
As an example of C++ features adoption, consider function-prototypes
adopted and provided in C89 as well as other features I do not remember now.
I thought about this for a while. At first, I thought that templates
in C was a very good idea. They lead to simpler, easier to understand
and more generic versions of data structures and algorithms. And to
create templates, you would not need all the machinery of C++. But
then I started to see holes in it. For instance, because you do not
have operator overloading, you cannot extend the pretty version of
sorting algorithms which have a compare operator, since C strings
would not compare correctly. Also, things like a complex number
template that I suddendly want to reuse for extended precision are not
going to work properly either. So the templates are really going to
be crippled in C. When I thought about it long enough I finally
decided that I would never use them, because I would use C++ to write
the algorithms like that anyway. In short, I think that the idea is
great on the surface but when you think about it they would be clearly
inferior to C++ templates because we do not have operator overloading
and constructors and other things that make them work so nicely in C+
+.
user923005 wrote:
>
I thought about this for a while. At first, I thought that templates
in C was a very good idea. They lead to simpler, easier to understand
and more generic versions of data structures and algorithms. And to
create templates, you would not need all the machinery of C++. But
then I started to see holes in it. For instance, because you do not
have operator overloading, you cannot extend the pretty version of
sorting algorithms which have a compare operator, since C strings
would not compare correctly. Also, things like a complex number
template that I suddendly want to reuse for extended precision are not
going to work properly either. So the templates are really going to
be crippled in C. When I thought about it long enough I finally
decided that I would never use them, because I would use C++ to write
the algorithms like that anyway. In short, I think that the idea is
great on the surface but when you think about it they would be clearly
inferior to C++ templates because we do not have operator overloading
and constructors and other things that make them work so nicely in C+
+.
Let's remove struct templates out for the moment. Regarding template
functions, function overloading is needed too, which is not a bad idea
for C to have too. I do not think any other C++ feature is needed for
this. Again, I have removed template structs out of the question.
Ioannis Vranos wrote:
user923005 wrote:
>> I thought about this for a while. At first, I thought that templates in C was a very good idea. They lead to simpler, easier to understand and more generic versions of data structures and algorithms. And to create templates, you would not need all the machinery of C++. But then I started to see holes in it. For instance, because you do not have operator overloading, you cannot extend the pretty version of sorting algorithms which have a compare operator, since C strings would not compare correctly. Also, things like a complex number template that I suddendly want to reuse for extended precision are not going to work properly either. So the templates are really going to be crippled in C. When I thought about it long enough I finally decided that I would never use them, because I would use C++ to write the algorithms like that anyway. In short, I think that the idea is great on the surface but when you think about it they would be clearly inferior to C++ templates because we do not have operator overloading and constructors and other things that make them work so nicely in C+ +.
Let's remove struct templates out for the moment. Regarding template
functions, function overloading is needed too, which is not a bad idea
for C to have too. I do not think any other C++ feature is needed for
this. Again, I have removed template structs out of the question.
The correct terminology is "function template", which is what they are,
templates used to construct functions. The biggest issue with the
apparently simple addition of function overloading is the requirement
for standardised name mangling, which would break backwards
compatibility. Then there's all the matching rules to consider.
All this is best left where it belongs, in C++.
--
Ian Collins.
jacob navia wrote:
>
But then, why not compile time functions?
I'd be interested in discussing this off-line, email my Usenet address
and I'll reply with my real one.
--
Ian Collins.
Ian Collins wrote:
jacob navia wrote:
>But then, why not compile time functions?
I'd be interested in discussing this off-line, email my Usenet address
and I'll reply with my real one.
My usenet address is below in my .sig
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique http://www.cs.virginia.edu/~lcc-win32 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Robert Dodier |
last post by:
Hello,
Here's a thought that I'm sure has already occurred to
someone else, I just can't find any record of it yet.
An XML document is just a more verbose and clumsy representation
of an...
|
by: spiros |
last post by:
Hi,
suppose you have the class Class1 and the main program:
class Class1
{
public:
Class1();
~Class1();
|
by: Johnny Lee |
last post by:
Hi,
I've met a problem in match a regular expression in python. Hope
any of you could help me. Here are the details:
I have many tags like this:
xxx<a href="http://xxx.xxx.xxx" xxx>xxx
xxx<a...
|
by: Faraz |
last post by:
Thanks Dave,
To repeat the question:
I am developing a WinForms application and I need a Math Expression
validator, not an expression evaluator. So I want to be able to say...
if ((sales - tax)...
|
by: Arash Partow |
last post by:
Hi all,
I've ported various hash functions to python if anyone is interested:
def RSHash(key):
a = 378551
b = 63689
hash = 0
|
by: dmoran21 |
last post by:
I am a mathematician trying to write a program in C to do some curve
fitting. When I get to the point where I attempt to enter data in my
arrays, I get a General Protection Exception error message....
|
by: CHU Run-min |
last post by:
The following code was written by me.
It is used for evaluating constant expressions.
I think it is good. Any criticism?
namespace Churunmin.HelloWorld
{
|
by: TimeHorse |
last post by:
I would like to gauge interest in the following proposal:
Problem:
Assignment statements cannot be used as expressions.
Performing a list of mutually exclusive checks that require data...
|
by: Marc Gravell |
last post by:
In Linq, you can apparently get a meaningful body from and
expression's .ToString(); random question - does anybody know if linq
also includes a parser? It just seemed it might be a handy way to...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |