if ( a == 3 ) --- if( a is 3 )
if ( a != 3 ) ---if ( a not 3 )
if( a b && b c ) ---if ( a b c ) , if( a b and b >c )
if( a b || b c ) ---if ( a >b or b c )
those are more human readable, I guess
I know some can be done be "Macro" , and some
some might hard for compiler implementation, but does it make sense to
both human & computer ?
if so why not, please !
and we need default value on function, not only from the end
like this : my_function ( default, default, 0 ); can we ? 13 1537
if ( a == 3 ) --- if( a is 3 )
if ( a != 3 ) ---if ( a not 3 )
if( a b && b c ) ---if ( a b c ) , if( a b and b >c )
if( a b || b c ) ---if ( a >b or b c )
those are more human readable,
Yes they are, but programming code is not a conversation. I think you'll find
that symbolic operators are more prefereable for actual code.
and we need default value on function, not only from the end
like this : my_function ( default, default, 0 ); can we ?
I believe they are adding such functionality to the language.
--
Frederick Gotham hk***@hotmail.com wrote:
if ( a == 3 ) --- if( a is 3 )
if ( a != 3 ) ---if ( a not 3 )
if( a b && b c ) ---if ( a b c ) , if( a b and b >c )
if( a b || b c ) ---if ( a >b or b c )
those are more human readable, I guess
I know some can be done be "Macro" , and some
some might hard for compiler implementation, but does it make sense to
both human & computer ?
if so why not, please !
and we need default value on function, not only from the end
like this : my_function ( default, default, 0 ); can we ?
Oh please don't. Bourne used all these hideous macros to change
C into another language and it made working on his code nearly
impossible. If you don't like C++, go find another language.
By the way, there exist a few alternate tokens (mostly to
get around character set issues).
if(a not_eq 3)
is perfectly valid as is
if( a b or b c)
if(a b and b c)
Perhaps you should learn how to use C++ fully before deciding it
needs changing.
Ron Natalie posted:
Oh please don't. Bourne used all these hideous macros to change
C into another language and it made working on his code nearly
impossible.
Would a simple "Find/Replace" facility not fix the problem in a matter of
minutes... ? E.g.
Find: is
Replace: ==
--
Frederick Gotham
Frederick Gotham wrote:
Ron Natalie posted:
>Oh please don't. Bourne used all these hideous macros to change C into another language and it made working on his code nearly impossible.
Would a simple "Find/Replace" facility not fix the problem in a matter of
minutes... ? E.g.
Find: is
Replace: ==
Well there were a lot of them and it left the white space all hosed up
as well. Someone else up at Bell Labs fortunately translated it all
back into regular C somewhere before System VR2 came out.
Frederick Gotham wrote:
Ron Natalie posted:
Oh please don't. Bourne used all these hideous macros to change
C into another language and it made working on his code nearly
impossible.
Would a simple "Find/Replace" facility not fix the problem in a matter of
minutes... ? E.g.
Find: is
Replace: ==
<sarcasm>Of course no sane person would ever use the word "is" in a
comment.</sarcasm>
Regards,
Bart.
Bart wrote:
Frederick Gotham wrote:
Ron Natalie posted:
Oh please don't. Bourne used all these hideous macros to change
C into another language and it made working on his code nearly
impossible.
Would a simple "Find/Replace" facility not fix the problem in a matter of
minutes... ? E.g.
Find: is
Replace: ==
<sarcasm>Of course no sane person would ever use the word "is" in a
comment.</sarcasm>
Heh, or you could have something like:
istream& operator >(istream& is , myClass& mc ); hk***@hotmail.com wrote:
and we need default value on function, not only from the end
like this : my_function ( default, default, 0 ); can we ?
do you like it?
class my_function_params {
public:
my_function_params()
: m_param1(default_value_for_param1)
, m_param2(default_value_for_param2)
... () {
}
my_function_params& param1(param1_type new_value) { m_param1 =
new_value; return *this; }
my_function_params& param2(param2_type new_value) { m_param2 =
new_value; return *this; }
...
param1_type param1() { return m_param1; }
param2_type param2() { return m_param2; }
...
private:
param1_type m_param1;
param2_type m_param2;
...
};
void my_function(my_function_params params) {
// use params.param1(), ...
}
my_function( my_function_params().param3(56).param5("hi!") );
--
Helio Tejedor jj*****@yahoo.com wrote:
Bart wrote:
Frederick Gotham wrote:
Ron Natalie posted:
>
Oh please don't. Bourne used all these hideous macros to change
C into another language and it made working on his code nearly
impossible.
>
>
Would a simple "Find/Replace" facility not fix the problem in a matter of
minutes... ? E.g.
>
Find: is
Replace: ==
<sarcasm>Of course no sane person would ever use the word "is" in a
comment.</sarcasm>
Heh, or you could have something like:
istream& operator >(istream& is , myClass& mc );
Not if 'is' is a macro. That was the whole point.
Regards,
Bart.
Bart wrote:
jj*****@yahoo.com wrote:
>Bart wrote:
>>Frederick Gotham wrote: Ron Natalie posted:
Oh please don't. Bourne used all these hideous macros to change C into another language and it made working on his code nearly impossible.
Would a simple "Find/Replace" facility not fix the problem in a matter of minutes... ? E.g.
Find: is Replace: ==
<sarcasm>Of course no sane person would ever use the word "is" in a comment.</sarcasm>
Heh, or you could have something like:
istream& operator >(istream& is , myClass& mc );
Not if 'is' is a macro. That was the whole point.
I think he forgot to mention
#undef is
right before that line...
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Victor Bazarov posted:
>>><sarcasm>Of course no sane person would ever use the word "is" in a comment.</sarcasm>
Heh, or you could have something like:
istream& operator >(istream& is , myClass& mc );
Not if 'is' is a macro. That was the whole point.
I think he forgot to mention
#undef is
right before that line...
So basically you'd need something like:
After the macro definition of "is":
(1) Search for "is"
(2) If "/*" is encountered beforehand, then disable the find/replace
algorithm until "*\" is found.
(3) If "#undef is" is found, then abandon the search.
(4) Finally, for all other times where "is" is found, replace it with ==.
--
Frederick Gotham
Frederick Gotham wrote:
So basically you'd need something like:
After the macro definition of "is":
(1) Search for "is"
(2) If "/*" is encountered beforehand, then disable the find/replace
algorithm until "*\" is found.
(3) If "#undef is" is found, then abandon the search.
(4) Finally, for all other times where "is" is found, replace it with ==.
Of course, with the additional "minor" provisions for string litterals,
and // comments and line-continuations in // comments, and the
possibility of having #undef inside #if... blocks, or the possibility
of having the word 'is' on a #error line, or a header named "is", it's
a very "trivial" task. Like you said, a matter of minutes...
Regards,
Bart.
Frederick Gotham wrote:
hk***@hotmail.com wrote:
>and we need default value on function, not only from the end like this : my_function ( default, default, 0 ); can we ?
I believe they are adding such functionality to the language.
Is this definite? Do you know when the new "functionality" is planned for? Most
importantly, are they adding a lambda keyword?
(The single thing I hate most about C++ is the huge amount of fiddle needed to
write, say, a one-off function to pass to a generic algorithm, eg (deliberately
stupid example), writing this:
struct print: public std::unary_function <void, int>
{
void operator() (int x) { std::cout << x << std::endl(); };
};
void some_other_function()
{
std::vector<intv;
// ... //
for_each(v.begin(), v.end(), print());
// ... //
}
instead of (say) this:
void some_other_function()
{
std::vector<intv;
// ... //
for_each(v.begin(), v.end(), int lambda(int x)
{ std::cout << x << std::endl(); } );
// ... //
}
) <-- this bracket was opened a long way back...
Tom
Tom Smith wrote:
Frederick Gotham wrote:
>hk***@hotmail.com wrote:
>
>>and we need default value on function, not only from the end like this : my_function ( default, default, 0 ); can we ?
I believe they are adding such functionality to the language.
Is this definite? Do you know when the new "functionality" is planned
for? Most importantly, are they adding a lambda keyword?
I believe (incidentally) that Norvig, amongst others, is very keen on this.
T This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: James |
last post by:
I have a from with 2 fields:
Company & Name
Depening which is completed, one of the following queries will be run:
if($Company){
$query = "Select C*
From tblsample
Where ID = $Company...
|
by: Scott D |
last post by:
I am trying to check and see if a field is posted or not, if not
posted then assign $location which is a session variable to
$location_other. If it is posted then just assign it to...
|
by: Nick |
last post by:
Can someone please tell me how to access elements from a multiple
selection list? From what ive read on other posts, this is correct. I
keep getting an "Undefined variable" error though...
Form...
|
by: Alexander Ross |
last post by:
I have a variable ($x) that can have 50 different (string) values. I want
to check for 7 of those values and do something based on it ... as I see it
I have 2 options:
1) if (($x=="one") ||...
|
by: Dan Foley |
last post by:
This script runs fine, but I'd like to know why it's so slow.. Thanks
for any help out there on how i can make it faster (it might take up
to 5 min to write these 3 export files whith 15 records...
|
by: Lee Redeem |
last post by:
Hi there
I've created abd uploaded this basic PHP script:
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<H1 align="center">
|
by: christopher vogt |
last post by:
Hi,
i'm wondering if there is something like $this-> to call a method inside
another method of the same class without using the classname in front.
I actually use
class TEST
{
function...
|
by: Phil Powell |
last post by:
Ok guys, here we go again!
SELECT s.nnet_produkt_storrelse_navn
FROM nnet_produkt_storrelse s, nnet_produkt_varegruppe v,
nnet_storrelse_varegruppe_assoc sv, nnet_produkt p
WHERE...
|
by: Michel |
last post by:
a site like this
http://www.dvdzone2.com/dvd
Can you make it in PHP and MySQL within 6 weeks?
If so, send me your price
2 a r a (at) p a n d o r a . b e
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |