T
Tom Shelton
The one thing that Relf's code does has hands down is speed.
Fast code that doesn't work is pretty much usless.
The one thing that Relf's code does has hands down is speed.
Tom said:Fast code that doesn't work is pretty much usless.
Jeff_Relf said:or any other of the staggeringly bad C++ code in your example.
Frankly, the only time I've ever seen worse C coding
is in the Obfuscated C contests, and they're trying to write bad code,
not proclaiming it as good code.
One of my developers writes uncommented spaghetti crap like that
and I'd fire them on the spot. >>
Loop() is great shorthand, much better than for(; or whatever it is you use.
Sean Hederman said:So by that argument a programming language is as old as it's most recent
incarnation? Okay.
It won't be any time soon, though. After all, COBOL is still being used
for a lot of new development, and Java is getting to be just as embedded.
Olaf Baeyens said:I did look a C# generated assembler code, and I am not refering to ILASM but
to the real processor dependend assembler code and I am still very suprised
to see how nice the C# code gets converted to the raw processor power code.
It is really near C++ code. Any slowdowns is mostly related to using some
library functions or bad programming. Ofcourse using Interop and using
properties ans stuff, it also slows down, but so would C++ if you use
properties.
No one can predict the future.
Olaf Baeyens said:The C# way maybe not but if I remember the properties in C++ the methods
must be virtual.
string name = "Alt.OS.Windows-XP, Comp.OS.Linux.Advocacy";
Console.Write(name.ToLower());
Jeff_Relf said:In Microsoft C++ 7.1, I use these macros for drawing lines:
#define mt( x, y ) MoveToEx( DC, x, y, 0 )
#define lt( x, y ) LineTo( DC, x, y )
And, while the higher level Tools found in C# don't apeal to me,
the lower level tools, like macros, are oddly Verboten .
LoopTo() and ER(), shown below, are the Tools I prefer,
but C# doesn't allow macros like that.
So how would you write this in C# ?
#define LOOP while ( 1 )
#define \
LoopTo( StopCond ) \
while ( Ch && ( Ch = ( uchar ) * ++ P \
, Ch2 = ( uchar ) P [ 1 ] \
, Ch ) \
&& ! ( StopCond ) )
typedef char * LnP ; // The name LnP comes from a naming convention I use.
int rv ; // Although it's a global, rv is what I call a Super_Temp.
// ER() and er() are shorthand for Bigg_ER() and Small_er()
__int64 ER( __int64 X, __int64 Y ) { return X > Y ? X : Y ; }
__int64 er ( __int64 X, __int64 Y ) { return X < Y ? X : Y ; }
LnP LowerCaseNG ( LnP Mixed ) { static LnP B; static int Sz_B ;
rv = ER( 200, strlen ( Mixed ) + 1 );
if ( Sz_B != rv ) { free ( B ); B = ( LnP ) malloc( Sz_B = rv ); }
LnP P = Mixed, D = B - 1 ; int Ch = * P --, Ch2 = 0 ;
LoopTo ( 0 ) if ( Ch > 32 && Ch < 128 ) * ++ D = tolower ( Ch );
* ++ D = 0 ; return B ; }
main() {
printf( "%s"
, LowerCaseNG ( "Alt.OS.Windows-XP, Comp.OS.Linux.Advocacy" ); LOOP; }
Except for the main() part, the code above is from:
http://www.Cotse.NET/users/jeffrelf/X.CPP
Re: My comment that I don't like the look of String, cout or the STL,
You told me: << Good one. Haven't laughed that hard for a while.
If someone told me some drek like that in an interview,
it'd be sayonara baby, call me when you're mature enough to actually solve
the problems that confront our customers at a reasonable price. >>
Nice delusion, but you're not my employer.
Loop() is great shorthand, much better than for(; or whatever it is you use.
I only care about what makes my code more readable,
Daring to stick your real name on, what you say.How is that "brave"?
Olaf said:Daring to stick your real name on, what you say.
Some people here make a lot of noise but they hide behind a nick name.
Dan said:So, you are saying that if someone can write a faster regex process
than .Net, then .Net is worthless. That sounds a bit overdramatic.
Like saying if you don't drive the fastest car you should stay at home
until you starve.
You can write a production site that is does not have the fastest regex
process, if it can be delivered on-time and meets the performance
requirements. If the assembly is to slow to meet requirements then you
make adjustments. That is why we test early.
Back By Demand said:C'mon...let's not be sophomoric.
If Relf can write code that is faster than the built in Regex object in
.NET and Microsoft is offering the .Net system as an alternative to
c/c++ programming...then the whole exercise is ridiculous.
It condemns all code written in c# to being substandard.
std::basic_string said:How can I create a production site or app that uses Regex if I can't be
guaranteed of fast text search?
At least I can see the source to know what text search algorithm they're
using in mono, but I can't even do that in .Net!
Alex said:Hello Jeff,
This is not good C++. Never was, never will be.
It may or may not be good C.
And, while the higher level Tools found in C# don't apeal to me,
the lower level tools, like macros, are oddly Verboten .LoopTo() and ER(), shown below, are the Tools I prefer,
but C# doesn't allow macros like that.
So how would you write this in C# ?
#define LOOP while ( 1 )
#define \
LoopTo( StopCond ) \
while ( Ch && ( Ch = ( uchar ) * ++ P \
, Ch2 = ( uchar ) P [ 1 ] \
, Ch ) \
&& ! ( StopCond ) )
Gaak!
What's wrong with templates and inline functions?
This is terrible, unmaintainable code.
It may be accepted in comp.os.linux.advocacy (I wouldn't know, I don't
frequent that group) but try posting it in comp.lang.c++.moderated and see
the reaction it will evoke.
I don't know who your employer is but I would like mine to be so lenient.
Tukla Ratte said:After all, COBOL is still being used for a lot of new development.
begin said:Right, and like "Olaf Baeyens" is a real name...gimme a break!
In comp.os.linux.advocacy, Tukla Ratte
<[email protected]>
wrote
We'll see. The MONO project might surprise all of us.
Microsoft -- because they probably want everyone to use Winforms
and other such proprietarianism.
Javadvocates -- because it's not Java. ;-)
Personally, I've not toyed with it so can't say, but Gtk# looks
mildly interesting. (There's also a Qt#.)
And you are the big expert in this?assemblies cannot be trusted -- as is.
Yes, and they do a pretty darn good job in my opinion if you look at theWhat is .NET really about? It's really a business relationship. Microsoft
must provide the trust that a person can use the .Net assemblies and
convert to c# and still get all the speed that would be part of a lower
level language.
How to you know that unmanaged C++ is doing its job at releasing the memory?And if they can't -- then I see no reason to convert! For example, how
can I possibly trust their "automatic garbage collection" -- how do I know
if it's doing the job?
It is under your nose but you don't see.Show us the facts!
Ohhhh, why would that not be my real name? Curious.Right, and like "Olaf Baeyens" is a real name...gimme a break!