LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-03-2009, 12:52 PM   #16
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231

atleast they dont do it the WTF way!:
Code:
void cats(smeeze, tina)
cat *smeeze;
cat *tina;
{
}
TURBO C++ gives a warning: Style of function defininition is now obsolete.
now if its obsolete in 1991 it is very obsolete now.
 
Old 11-04-2009, 03:29 AM   #17
JohnGraham
Member
 
Registered: Oct 2009
Posts: 467

Rep: Reputation: 139Reputation: 139
Quote:
Originally Posted by xhypno View Post
White space is not a delimiter in c or c++ unless you overload it so your comment about void being on a different line is completely incorrect.
You can overload whitespace? Really? If you can, please tell us how!

John G
 
Old 11-04-2009, 10:29 AM   #18
xhypno
Member
 
Registered: Sep 2004
Posts: 62

Rep: Reputation: 16
Quote:
Originally Posted by JohnGraham View Post
You can overload whitespace? Really? If you can, please tell us how!

John G
Here you go.

http://www2.research.att.com/~bs/whitespace98.pdf

It is a good paper from Stroustrup the creator of C++. I first read it in paper form in my hard back copy of The C++ Programming Language and used it a few times since for really odd ball problems.
 
Old 11-04-2009, 10:44 AM   #19
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,012

Rep: Reputation: 115Reputation: 115
Uh, that's non-standard, and completely different from what smeezekitty was talking about. I hope that *never* shows up in C++, it trades an easy parse error for a nasty missing operator error. Also it's a lot less clear because it breaks the ingrained training of C's lexing and grammar rules.
 
Old 11-04-2009, 11:46 AM   #20
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
Overload whitespace? i think not.
 
Old 11-04-2009, 01:08 PM   #21
xhypno
Member
 
Registered: Sep 2004
Posts: 62

Rep: Reputation: 16
Quote:
Originally Posted by tuxdev View Post
Uh, that's non-standard, and completely different from what smeezekitty was talking about. I hope that *never* shows up in C++, it trades an easy parse error for a nasty missing operator error. Also it's a lot less clear because it breaks the ingrained training of C's lexing and grammar rules.
News flash, this is in c also as it is what is used to create lex'ed combo operators for Logic.

And the comment to Smeeze was about his incorrect statement that the return type being on the line above the rest of the function def was wrong as white space doesn't delimit code in c or c++.

Last edited by xhypno; 11-04-2009 at 01:10 PM.
 
Old 11-04-2009, 01:09 PM   #22
xhypno
Member
 
Registered: Sep 2004
Posts: 62

Rep: Reputation: 16
Quote:
Originally Posted by smeezekitty View Post
Overload whitespace? i think not.
And again you show that your thinking is wrong.
 
Old 11-04-2009, 01:30 PM   #23
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Hmm, did anyone notice Stroustrup's whitespace overloading paper was an April fool joke ?
 
Old 11-04-2009, 01:32 PM   #24
xhypno
Member
 
Registered: Sep 2004
Posts: 62

Rep: Reputation: 16
Quote:
Originally Posted by jlliagre View Post
Hmm, did anyone notice Stroustrup's whitespace overloading paper was an April fool joke ?
funny thing is that is how it started and ended up in the ISO99 standard for c and c++
 
Old 11-04-2009, 01:59 PM   #25
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,012

Rep: Reputation: 115Reputation: 115
Quote:
Hmm, did anyone notice Stroustrup's whitespace overloading paper was an April fool joke ?
Oh yeah.. totally missed that. Haha, it's almost plausible enough to actually be serious. I really should have checked when he started mentioning Unicode characters..

Quote:
funny thing is that is how it started and ended up in the ISO99 standard for c and c++
That's blatantly wrong, overloading whitespace is definitely non-standard, especially the non-context-free lex extension (actually, good lex rules are regular expressions, but I'm being lax here). If you really want to prove it otherwise, write an example that'll compile in Comeau.
 
Old 11-04-2009, 02:09 PM   #26
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
even if you did overload whitespace all code after it would have errors for example:
Code:
/*overload whitespace here*/
int main(){
   ^                     |-Parse error
   |-Parse error         V
printf("Hello world! %d", 123);
        |-- Parse error
        V
unsigned j=0;
return(j);
}
 
Old 11-04-2009, 02:25 PM   #27
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,012

Rep: Reputation: 115Reputation: 115
Those locations wouldn't cause parse errors - the whitespace operator would be an r-value expression.
 
Old 11-04-2009, 02:38 PM   #28
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
i tried it:
turbo C++ errors:
Code:
 Compiling OW.CPP:
•Error OW.CPP 2: Overloadable operator expected
 Error OW.CPP 2: Declaration terminated incorrectly
GNU CC
Code:
ow.cpp:2: error: expected identifier before '\x20'
ow.cpp: In function `int main()':
ow.cpp:4: error: expected `)' before numeric constant
ow.cpp:5:2: warning: no newline at end of file
CODE:
Code:
#include <stdio.h>
double operator ' '(double d1, double d2) { return d1*d2; }
int main(){
printf("%d", 2 2);
}
 
Old 11-04-2009, 05:43 PM   #29
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Quote:
Originally Posted by jlliagre View Post
Hmm, did anyone notice Stroustrup's whitespace overloading paper was an April fool joke ?
I have to admit, the first time I read that a few years ago I was halfway through writing a post about how preposterous the idea was by the time read the "April fools" part...
Kevin Barry

PS On the other hand, one would think overloading operator , would be just as ridiculous, yet it's perfectly valid...
 
Old 11-04-2009, 05:46 PM   #30
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Quote:
Originally Posted by xhypno View Post
funny thing is that is how it started and ended up in the ISO99 standard for c and c++
What? Do you have a reference? And I don't mean "C99"; do you have a section/paragraph in mind?
Kevin Barry
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Obsolete skills andrew375 General 31 04-18-2008 11:36 AM
dot space dot binary_0011 Linux - Newbie 5 09-14-2006 07:43 AM
useradd not accepting dot so i am not able to use dot in mail id hanu_raob Linux - General 5 05-13-2004 07:04 AM
M$ Doz obsolete? witeshark General 11 02-07-2004 06:45 PM
Is Microsoft Obsolete? GtkUser General 24 07-24-2003 07:34 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration