469,341 Members | 6,703 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,341 developers. It's quick & easy.

c# is a good way to learn c


After working in c# for a year, the only conclusion I can come to is
that I wish I knew c.

All I need is Linux, the gnu c compiler and I can do anything.

Web services are just open sockets hooked up to interfaces.

The Gtk is more than enough gui.

Jul 21 '05
354 13590
Tom Shelton wrote:
In article <42**************@vatican.us>, American Pope wrote:
Sean Hederman wrote:
"Jeff_Relf" <Me@Privacy.NET> wrote in message
news:Je***********************@Cotse.NET...
For example, how would you write this high/low byte swapper in C # ?
typedef unsigned __int8 * uint_8_P ;
__int32 Swap_32 ( __int32 X ) { uint_8_P P = ( uint_8_P ) & X + 4 ;
return * -- P << 24 | * -- P << 16 | * -- P << 8 | * -- P ; }
Ummm, actually it does nothing of the sort. Swapping the high and low bytes
of the number 32 gives me 536870912, and your result is 538976288. And in C#
the code would be:
int swapped = System.Net.IPAddress.NetworkToHostOrder(unswapped) ;


The one thing that Relf's code does has hands down is speed.

Fast code that doesn't work is pretty much usless.


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.

How can I create a production site or app that uses Regex if I can't be
guaranteed of fast text search?

And why should I trust any assembly? Do I have to vet each and every
one of them to make sure that they do not have defects or faults?

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!
Jul 21 '05 #101
Jeff_Relf wrote:
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.


Jeff,

You're certainly winning this debate in my estimation.

The bottom line, after experimenting with Regex, is that the .Net
assemblies cannot be trusted -- as is.

What 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.

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?

Show us the facts!

Jul 21 '05 #102

"Sean Hederman" <em*******@codingsanity.blogspot.com> wrote in message news:d3**********@ctb-nnrp2.saix.net...
So by that argument a programming language is as old as it's most recent
incarnation? Okay.


A programming language is as old as its first version and as modern as its most recent incarnation.

--
Address email to user "response" at domain "alexoren" with suffix "com"
Jul 21 '05 #103
In comp.os.linux.advocacy, Tukla Ratte
<tu*********@tukla.net>
wrote
on Thu, 07 Apr 2005 10:43:30 -0500
<m2************@stitch.tukla.net>:
"Montrose..." <ro***@trower.rocks> writes:
Olaf Baeyens wrote:
No one can predict the future.
Just wait and see. But at least I would advice you to look at C# otherwise
you risk to be outdated if the market moves in that direction. You don't
learn it overnight.


I thouroughly agree.

I can easily see a 'tipping point' for c# where java will all but be
eradicated.


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.


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#.)

--
#191, ew****@earthlink.net
It's still legal to go .sigless.
Jul 21 '05 #104
Hello Olaf,

"Olaf Baeyens" <ol**********@skyscan.be> wrote in message news:42**********************@news.skynet.be...
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.


Why would properties cause slowdowns?

As I understand it, a property is just a function call which can be inlined in most cases and usually completely optimized away.
That, of course, depends on the quality of the compiler/optimizer but MS has some experience in that area.
As for being old, we'll come back to laugh at you for using C# when C++0x
is available, and you're a doddering old man like myself.

No one can predict the future.


But one can prepare for it.

The top C++ developers are already adapting their habits to C++0x by using the boost libraries and keeping track of WG21 proceedings.

Jul 21 '05 #105

"Olaf Baeyens" <ol**********@skyscan.be> wrote in message news:42*********************@news.skynet.be...
Properties don't slow down your code in the simple case:

The C# way maybe not but if I remember the properties in C++ the methods
must be virtual.


C++ virtual method calls can be inlined when called directly (not via a base ptr or reference).

--
Address email to user "response" at domain "alexoren" with suffix "com"
Jul 21 '05 #106
Dan
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.

I don't understand this rampant black and white perception of these
issues. As an engineer, I feel it is my job to use whatever technology
I can to best accomplish the task. One of the most critical
requirements everywhere I have worked is maintainability of code. Can
someone else, of lesser skill and experience than you, add to your work
without having to pour over it for weeks or completely rework vast
sections of code? Language selection is influenced greatly by this
issue. How much will it cost to bring on a new person and get them
productive?

-Dan

Jul 21 '05 #107
HEY! I wanted to commented on that. :-)
Ik just installed C# on my new computer and now you gave the sollutions :
main() {
printf( "%s"
, LowerCaseNG ( "Alt.OS.Windows-XP, Comp.OS.Linux.Advocacy" ); LOOP; }


string name = "Alt.OS.Windows-XP, Comp.OS.Linux.Advocacy";
Console.Write(name.ToLower());


This would be he complete code:
---------------------
using System;
namespace ConsoleApplication1
{
class Class1 {
[STAThread]
static void Main(string[] args) {
string name = "Alt.OS.Windows-XP, Comp.OS.Linux.Advocacy";
Console.Write(name.ToLower());
}
}
}
----------------------

The rest is already explained I believe.

But Jeff makes the mistake to keep C# comparing with C++ which have a
complete different way of thinking and technology.
C# doesn"t need macros's and in my opinion macros is making code even more
unreadable since it is very hard to deciper what it is supposed to do.
And in many cases, Macro's don't always make your code faster. One
dimensional macros maybe, but once a macro uses a macro in a macro, then you
have no idea where you en up.

If you need speed then you must create one monolythic function that does
this one operation.

Now for the swap thing: The macro could be written like this in C#

iOriginal=iOriginal;
int swapped=(((byte) iOriginal)) << 24 | ((byte) (iOriginal >> 8)) << 16 |
((byte) (iOriginal >> 16)) << 8 | ((byte) (iOriginal >> 24));

And when decoded in assembler by the JIT (the debug version) you get this:
(I reverse engineered so you can follow what the assembler is doing)
Because of the newsgroup post wrapping will occure so unwrap it manually in
notpad or so, it is really worth it.

00000090 mov eax,esi // eax=iOriginal
00000092 and eax,0FFh // (byte) iOriginal (converting int to byte)
00000097 shl eax,18h // (byte) iOriginal<< 24
0000009a mov edx,esi // edx=iOriginal
0000009c sar edx,8 // iOriginal >> 8
0000009f and edx,0FFh // ((byte) (iOriginal >> 8))
000000a5 shl edx,10h // ((byte) (iOriginal >> 8)) << 16
000000a8 or eax,edx // ((byte) iOriginal)) << 24 | ((byte)
(iOriginal >> 8)) << 16
000000aa mov edx,esi // edx=iOriginal
000000ac sar edx,10h // iOriginal >> 16
000000af and edx,0FFh // ((byte) (iOriginal >> 16))
000000b5 shl edx,8 // ((byte) (iOriginal >> 16)) << 8
000000b8 or eax,edx // ((byte) iOriginal)) << 24 | ((byte)
(iOriginal >> 8)) << 16 | ((byte) (iOriginal >> 16)) << 8
000000ba mov edx,esi // edx=iOriginal
000000bc sar edx,18h // iOriginal >> 24
000000bf and edx,0FFh // ((byte) (iOriginal >> 24)
000000c5 or eax,edx // ((byte) iOriginal)) << 24 | ((byte)
(iOriginal >> 8)) << 16 | ((byte) (iOriginal >> 16)) << 8 | ((byte)
(iOriginal >> 24)
000000c7 mov ebx,eax // copy to the swap variable.

So very compact in my opinion.
Also note not temporary memory values, pure register operations
SO LIGHTNING FAST!!!!!

If you would check C++ code then you will also see something like this.
There goes the mystery that C# would be slower!!!! It is not!
And I even didn't use the unsafe keyword! Pure managed.

Now for the alternative way:
----
class Class1 {
static public int Swap_32(int iOriginal) {
return (((byte) iOriginal)) << 24 | ((byte) (iOriginal >> 8)) <<
16 | ((byte) (iOriginal >> 16)) << 8 | ((byte) (iOriginal >> 24));
}
[STAThread] static void Main(string[] args) {
int iOriginal=0x01234567;
iOriginal=Class1.Swap_32(iOriginal);
}
}
----

iOriginal=Class1.Swap_32(iOriginal);
translates to:

00000015 mov ecx,esi
00000017 call dword ptr ds:[009750E0h]
0000001d mov edi,eax
0000001f mov esi,edi

static public int Swap_32(int iOriginal) {
return (((byte) iOriginal)) << 24 | ((byte) (iOriginal >> 8)) << 16 |
((byte) (iOriginal >> 16)) << 8 | ((byte) (iOriginal >> 24));
}

This translates to:
00000000 push ebp
00000001 mov ebp,esp
00000003 sub esp,8
00000006 push edi
00000007 push esi
00000008 mov esi,ecx
0000000a xor edi,edi
---
0000000c mov eax,esi
0000000e and eax,0FFh
00000013 shl eax,18h
00000016 mov edx,esi
00000018 sar edx,8
0000001b and edx,0FFh
00000021 shl edx,10h
00000024 or eax,edx
00000026 mov edx,esi
00000028 sar edx,10h
0000002b and edx,0FFh
00000031 shl edx,8
00000034 or eax,edx
00000036 mov edx,esi
00000038 sar edx,18h
0000003b and edx,0FFh
00000041 or eax,edx
00000043 mov edi,eax
---
00000045 jmp 00000047
00000047 mov eax,edi
00000049 pop esi
0000004a pop edi
0000004b mov esp,ebp
0000004d pop ebp
0000004e ret

So in this case you have the expected overhead of executing a call and
setting up a stack.

Have some fun :-)
Jul 21 '05 #108
Hello Jeff,

"Jeff_Relf" <Me@Privacy.NET> wrote in message news:Je***********************@Cotse.NET...
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 )
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?
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
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.
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.
I don't know who your employer is but I would like mine to be so lenient.
Loop() is great shorthand, much better than for(;;) or whatever it is you use.

I only care about what makes my code more readable,


More readable to who?

Cute rewriting of C++ syntax is universally considered as bad practice.
Don't take my word for it, c.l.c++.m (see above) is a great resource - you have Stroustrup, Sutter, Alexandrescu and their peers actively participating in discussions there and offering ego-less advice.

Standards, conventions and idioms are good for a reason.
Any C and C++ programmer should recognize for(;;) at a glance.

--
Address email to user "response" at domain "alexoren" with suffix "com"
Jul 21 '05 #109
>> And that people that are more realistic actually are more brave to user
their real names.


How is that "brave"?

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.
Jul 21 '05 #110
Olaf Baeyens wrote:
And that people that are more realistic actually are more brave to user
their real names.


How is that "brave"?


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.


Right, and like "Olaf Baeyens" is a real name...gimme a break!

Jul 21 '05 #111
Dan wrote:
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.
No...I'm saying I need to know the exact specifications of the built-in
Regex so that I can determine if I need to write my own.
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.


There are other factors like stability, reliability and so on.

All I'm saying is I need metrics so I can make my decision.

I guess I could blindly test each assembly method...
Jul 21 '05 #112

"Back By Demand" <b@b.demand> wrote in message news:aa********************@speakeasy.net...
C'mon...let's not be sophomoric.
I agree.
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.
The question is, is Relf's code as flexible and full-featured as MS's?

Special-purpose code *should* be faster than a generic solution.
It condemns all code written in c# to being substandard.
I fail to follow your reasoning.

std::basic_string<> is suboptimal. Does it mean that all C++ code is doomed to mediocrity?
How can I create a production site or app that uses Regex if I can't be
guaranteed of fast text search?
Have you heard about premature optimization?
If the regex search is not your bottleneck, you should not worry about its speed.
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!


Try http://www.aisto.com/roeder/dotnet

Jul 21 '05 #113
Alex wrote:
Hello Jeff,

"Jeff_Relf" <Me@Privacy.NET> wrote in message
news:Je***********************@Cotse.NET...
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 )
This is not good C++. Never was, never will be.
It may or may not be good C.


Nope. It makes assumptions. For example that a valid DC is present
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!


Welcome to te world of Relf garbage
What's wrong with templates and inline functions?
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


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.


Relf is a windows using retard who has chosen comp.os.linux.advocacy as his
playground, entertained by another win-retard, John Bailo
Both have nothing at all to do with linux
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.


I don't know who your employer is but I would like mine to be so lenient.


He is unemployable
He lives on welfare checks and witholding payment for his kids
And is actually proud of being a social misfit

< snip >
Jul 21 '05 #114

"Tukla Ratte" <tu*********@tukla.net> wrote in message news:m2************@stitch.tukla.net...
After all, COBOL is still being used for a lot of new development.


Source?

Jul 21 '05 #115
begin virus.scr Back By Demand wrote:
Olaf Baeyens wrote:
And that people that are more realistic actually are more brave to user
their real names.

How is that "brave"?


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.


Right, and like "Olaf Baeyens" is a real name...gimme a break!


Leave it to JBailo to make the real stupid posts. Like this one
Did you notice from where Olaf posts? Could you perhaps imagine that they
have different names in Belgium?
No, I guess you can't. Way too stupid for that

Jul 21 '05 #116
In article <85************@sirius.athghost7038suus.net>, The Ghost In The Machine wrote:
In comp.os.linux.advocacy, Tukla Ratte
<tu*********@tukla.net>
wrote
on Thu, 07 Apr 2005 10:43:30 -0500
<m2************@stitch.tukla.net>:
"Montrose..." <ro***@trower.rocks> writes:
Olaf Baeyens wrote:

No one can predict the future.
Just wait and see. But at least I would advice you to look at C# otherwise
you risk to be outdated if the market moves in that direction. You don't
learn it overnight.
I thouroughly agree.

I can easily see a 'tipping point' for c# where java will all but be
eradicated.


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.


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#.)


QT# is no longer in development. It is a dead project. I would like to
see someone pick it up though...

--
Tom Shelton
Jul 21 '05 #117
> The bottom line, after experimenting with Regex, is that the .Net
assemblies cannot be trusted -- as is.
And you are the big expert in this?
Did you have this from first hand or from hear-say?
And if it is from hear-say were these people experts or newbies using C
techniques in the C# violating the way C# worked?
What 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.
Yes, and they do a pretty darn good job in my opinion if you look at the
assembly code created by the JIT in one of my previous posts.
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?
How to you know that unmanaged C++ is doing its job at releasing the memory?
The same way, you run a program as long as possible and check the memory.
In the last 2 years I created a lot of C# programs, and some of them are
pretty complicated using OpenGL and rendering a complete 3D scene, so I have
object instances to multiple lists. And it simply works. Reliably!
Show us the facts!

It is under your nose but you don't see.
Jul 21 '05 #118
>>>>And that people that are more realistic actually are more brave to user
their real names.

How is that "brave"?


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.


Right, and like "Olaf Baeyens" is a real name...gimme a break!

Ohhhh, why would that not be my real name? Curious. :-)
Jul 21 '05 #119
Olaf Baeyens wrote:
Ohhhh, why would that not be my real name? Curious. :-)


*plonk*

Jul 21 '05 #120
Alex wrote:
This is terrible, unmaintainable code.


You've been trolled by the Relf troll. As he's already been informed
of his idiocy, there's really no reason why you should not place him
in your bozo bin. Nothing you say will help him understand, believe
me.

Jul 21 '05 #121
Sean Hederman poked his little head through the XP firewall and said:
"Olaf Baeyens" <ol**********@skyscan.be> wrote in message
news:42***********************@news.skynet.be...
[Snip]
PS: Personaly I would program in Assembler, because that would prove my
real
skill and I love doing it,


You love programming Assembler? I've done it, I'm glad I did it, and I'm
very, very happy I don't have to do it again (touch wood).


You said "touch wood".

Truthfully, though, a knowledge of assembler is very useful when your
debugging takes you into library or system routines for which you don't have
the source code.

Believe it or not, if you do it right, you can gradually build up a speed in
coding assembler that is surprising.

But I've forgotten much of what I knew about masm.

--
When all you have is a hammer, everything looks like a nail.
When all you have is Microsoft software, everything looks like Windows.
Jul 21 '05 #122
billwg poked his little head through the XP firewall and said:
Linønut wrote:

"inhouse line of business applications" -- can you give me some examples of
such applications, as I'm not familiar with this particular application
niche.
Heavens, nut, you're totally missing the boat! Too much time spent
defending the OSS initiatives probably.


Get real.
This kind of stuff is the mainstay of programming and the reason that
Microsoft and Sun and IBM and all the others are so filthy rich while
you get assigned to documentation duties.
Don't be stupid.
As an example, take a company that wants to automate their accounts
payable system for reimbursing salesmen for their excessive travel and
entertainment account expenses. They will do an "inhouse business
application" using their own staff, if the company is large enough, or a
local "consultant" if they don't have their own staff.
Actually, my first look, if I owned such a company, would be in the
open-source arena.
The system would be designed with a database piece, e-mail notification
piece, website webform piece, etc. These are the kinds of applications
that Java was created for and is principally used for and also where
.NET mostly lives.
I thought Java was first created for embedded devices, and then found that
other niche later.
What Microsoft has done is flesh out the java language, which was sort
of a subset of C++ to begin with, a little, but mostly the .NET
framework means the System namespace functions that make it so easy for
an applications person to conjure up a highly functional business app.
You have to see it to understand it.
I would suspect you are right.
If you are familiar with C++ in system situations, as you say, think
about what it takes to connect a program to a database, authenticating
the user and keeping him in a safe sandbox, querying for necessary
information and presenting it for edit/create/update. It takes some
code and takes some iterations and takes some time, no matter how great
you are at C++ and the interfaces you have to access.
Nah, I'd just grab an open-source library. Whether I was using C++,
C, Python, Perl, or even Tcl/Tk.
With .NET and C# or VB.NET (doesn't matter, they are the same thing in
the end) you just graphically access a data connection and stored
procedure and whatever presentation controls make sense, dragging them
onto the form and giving them names if you don't like DataConnection1,
and DataAdapter2, and suchlike naming. The .NET plumbing is
automatically hooked up by simple wizard-generated code and you are
ready to test.
I hope it works better than the plumbing in Visual Studio and MFC.
.NET goes beyond java in dumbing down the computer science to a point
where it is simple rote actions and all you need to know is application
dependent information, such as what you want the application to do
vis-a-vis the business. This so-called business logic still needs to be
directly coded into the application's forms or modules, but you can get
away with knowing next to nothing at all about the plumbing behind the
scenes.


That's cool, but sometimes you need to know about the plumbing, too.

It is dependent, to some extent, what your application domain is.

Anyone who thinks one paradigm fits the entire world of software development
has a simple view of this world.

--
When all you have is a hammer, everything looks like a nail.
When all you have is Microsoft software, everything looks like Windows.
Jul 21 '05 #123
Sean Hederman poked his little head through the XP firewall and said:
"Linønut" <"=?iso-8859-1?Q?lin=F8nut?="@bone.com> wrote in message
news:HN********************@comcast.com...
Sean Hederman poked his little head through the XP firewall and said:
C++ has it's place, but standard Windows business apps
are not one of them.


Because it doesn't guarantee slower development and more bugs, in our
hands.


Never once had a dangling pointer, unreclaimed memory, or a buffer overflow
then? C# has an easier syntax with less typing for the most part, so
logically if one was as proficient in C# as in C++, one's productivity would
be higher. This excludes the various visual designers and the powerful
libraries.


It also excludes that we are not now proficient in C#. We are proficient in
C++.
Also, we aren't doing "standard Windows business apps", we're doing
client/server stuff on a small network and reading information of off
ancient hardware.


Unless there's serious resource constraints/portability requirements, C#
should be able to do that easily.


Cool. We already done it with C++.

--
When all you have is a hammer, everything looks like a nail.
When all you have is Microsoft software, everything looks like Windows.
Jul 21 '05 #124
Alex poked his little head through the XP firewall and said:
"Tukla Ratte" <tu*********@tukla.net> wrote in message news:m2************@stitch.tukla.net...
After all, COBOL is still being used for a lot of new development.


Source?


I don't have any source myself, but google for "Visual COBOL". Or
"object-oriented COBOL".

--
When all you have is a hammer, everything looks like a nail.
When all you have is Microsoft software, everything looks like Windows.
Jul 21 '05 #125
"Linønut" <"=?iso-8859-1?Q?lin=F8nut?="@bone.com> wrote in message
news:Cu********************@comcast.com...
Truthfully, though, a knowledge of assembler is very useful when your
debugging takes you into library or system routines for which you don't
have
the source code.

Believe it or not, if you do it right, you can gradually build up a speed
in
coding assembler that is surprising.
Never got particularly quick in it, merely somewhat competant.
But I've forgotten much of what I knew about masm.
I used to use TASM and DJGPP. Ah, the memories...
--
When all you have is a hammer, everything looks like a nail.
When all you have is Microsoft software, everything looks like Windows.

Jul 21 '05 #126
"Linønut" <"=?iso-8859-1?Q?lin=F8nut?="@bone.com> wrote in message
news:_5********************@comcast.com...
billwg poked his little head through the XP firewall and said: [Snip]
With .NET and C# or VB.NET (doesn't matter, they are the same thing in
the end) you just graphically access a data connection and stored
procedure and whatever presentation controls make sense, dragging them
onto the form and giving them names if you don't like DataConnection1,
and DataAdapter2, and suchlike naming. The .NET plumbing is
automatically hooked up by simple wizard-generated code and you are
ready to test.


I hope it works better than the plumbing in Visual Studio and MFC.


Much, much, much better.
.NET goes beyond java in dumbing down the computer science to a point
where it is simple rote actions and all you need to know is application
dependent information, such as what you want the application to do
vis-a-vis the business. This so-called business logic still needs to be
directly coded into the application's forms or modules, but you can get
away with knowing next to nothing at all about the plumbing behind the
scenes.


That's cool, but sometimes you need to know about the plumbing, too.


I couldn't agree more. However, knowing about the plumbing doesn't mean you
need to *do* plumbing.
It is dependent, to some extent, what your application domain is.

Anyone who thinks one paradigm fits the entire world of software
development
has a simple view of this world.
Again, couldn't agree more.
--
When all you have is a hammer, everything looks like a nail.
When all you have is Microsoft software, everything looks like Windows.

Jul 21 '05 #127
"Linønut" <"=?iso-8859-1?Q?lin=F8nut?="@bone.com> wrote in message
news:_5********************@comcast.com...
Alex poked his little head through the XP firewall and said:
"Tukla Ratte" <tu*********@tukla.net> wrote in message
news:m2************@stitch.tukla.net...
After all, COBOL is still being used for a lot of new development.
Source?


I don't have any source myself, but google for "Visual COBOL". Or
"object-oriented COBOL".


I think there's also a version of COBOL for .NET, believe it or not.
--
When all you have is a hammer, everything looks like a nail.
When all you have is Microsoft software, everything looks like Windows.

Jul 21 '05 #128
>> Believe it or not, if you do it right, you can gradually build up a speed
in coding assembler that is surprising.


Never got particularly quick in it, merely somewhat competant.
But I've forgotten much of what I knew about masm.


I used to use TASM and DJGPP. Ah, the memories...

I prefered TASM :-) Over MASM but I knew both.
I was very saddened that C took over and assembler was forgotten and not
included with the C compiler anymore, but then again this is life.
Later I discovered tha assembler still exist but integrated in the C
language. :-)
But I never used it only in my current company I had to resourt on using MMX
assembler to speed up image processing of our X-ray scanner.

But currently I do not really have a need for that, the current processors
are very fast and there is no real speed gain anymore.
Speed is currently gained in other factors like hyper threading nowadays.


Jul 21 '05 #129
chrisv wrote:
Sean Hederman wrote:
"Jeff_Relf" <Me@Privacy.NET> wrote in message


*plonk* for feeding a cross-posted troll.


*unplonk* Sorry.

Jul 21 '05 #130
> If you want the best code, if you want code that can stand the test
of time, you need MS C++ 7.1 ( which is, de facto, the latest C from
Microsoft ).
....
If you're not picky, or you just don't have the experience under your

belt, you can go with C#, Java... or even HTML, for that matter.

It sounds to me as though you don't have much experience. :)

The "best" code? The best code can be simply defined as follows: The
code that gets the job done, within the constraints imposed by the
problem domain, does not bring the system to its knees, and can be
understood and maintained by programmers who don't charge an arm and a
leg for their time.

Often all of these things are competing requirements. You can tune the
living crap out of a program, make it run like lightning, but the only
people who will understand what's going on are C gurus with 10 years of
experience. So, you have a technically great product that costs a
fortune to maintain because the people you have to hire to maintain it
cost a fortune.

Or, you can develop a VB app that does the same thing, that an
entry-level programmer could understand, but which gobbles tons of
memory, pins the CPU, and takes ten times longer to execute.

What most businesses want, whether they are selling software or
developing in-house, is something in between. They don't want piggish
software, but then neither do they want to be forced to hire geniuses
at $200K a year.

Sometimes, the requirements for speed and efficiency require that
businesses throw lots of money at their wizard programmers. Certain
domains require this (device drivers, medical equipment, communications
equipment, etc.). Most domains don't.

"Better code," then, depends upon the context in which that code is to
be used and maintained. In my environment, which is in-house
development for a milling company, my reaction to a devilishly tricky,
but lightning-fast business analysis program would be to toss it in the
trash and write a new one that was much slower but also much more
easily maintained. My company wants people here focused on solving new
business problems, not tweaking and tuning what we have until it's a
jewel of efficiency, and then spending big bucks maintaining the
result. Other companies do want that efficiency, even if it costs... it
all depends upon the problem domain.

Jul 21 '05 #131
Sean Hederman poked his little head through the XP firewall and said:
"Linønut" <"=?iso-8859-1?Q?lin=F8nut?="@bone.com> wrote in message
That's cool, but sometimes you need to know about the plumbing, too.


I couldn't agree more. However, knowing about the plumbing doesn't mean you
need to *do* plumbing.


True. However, sometimes the plumbing is fun. I spent my Christmas
vacaction working out some rather puzzling problems in my socket & thread
code. Actually got to the point where I was a bit anxious (when I was
supposed to be relaxing!) Then I broke through the wall and got it all
basically working, and that was a great feeling, and I feel good knowing I
might well have a library that is about as fast as it could possibly be, and
it is cross-platform, safe to use, and fairly easy to use (if your app fits
the model the library supports).

Now, if I had to go this level all the time, I would definitely not get my
projects done on time, because I'd probably be in a sanitarium, gibbering.

In fact, my mental infrastructure is at a bit of an ebb right now, which is
probably why I'm hanging around here.

Thanks for the good conversation!

--
When all you have is a hammer, everything looks like a nail.
When all you have is C, everything looks like pointers.
Jul 21 '05 #132
In comp.os.linux.advocacy, Alex
<in******@online.nospam>
wrote
on Thu, 7 Apr 2005 14:28:32 -0400
<Ob**************@TK2MSFTNGP15.phx.gbl>:
Hello Jeff,

"Jeff_Relf" <Me@Privacy.NET> wrote in message news:Je***********************@Cotse.NET...
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 )
This is not good C++. Never was, never will be.
It may or may not be good C.


Highly debatable that it's good C. But this *is* RelfCode(tm)
we're discussing here. ;-)
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?


Nothing. He just likes macros.

Lots of macros.

A plethora of inlined constructs to insert where his mind pleases.
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
This is terrible, unmaintainable code.


He doesn't seem to have a problem with it. :-) Job security,
in a way.

I certainly wouldn't want to have to touch it, though, at least,
not on a maintenance basis. It's horrible, but there are
people who like to watch films of traffic accidents, too.
It may be accepted in comp.os.linux.advocacy (I wouldn't know,
I don't frequent that group)
Hah! The only reason one sees total dead silence as a response
is because most of us generally have recognized RelfCode(tm)
for what it is, and have kerplonked him low in the scorefile.

Me, I just find him a challenge. Not entirely sure why.
but try posting it in comp.lang.c++.moderated and see the
reaction it will evoke.
I would hope the moderators have very strong stomachs. (Not
that RelfCode(tm) wouldn't even win the Obfuscated C++ contest --
if there is one. It's not artistic enough. :-) )
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.
I don't know who your employer is but I would like mine
to be so lenient.


At some point one would hope for an employer that can at least
attempt to read C++ code, Java code -- heck, *any* code, or
maybe run a code analyzer to find the more common bugs.
Loop() is great shorthand, much better than for(;;) or whatever
it is you use.

I only care about what makes my code more readable,
More readable to who?


It's a code word. As far as we can tell, "readable" to Jeff
means "totally incomprehensible but it fits on a small screen
during munging" to everyone else. (I base this on Jeff
working on someone else's code -- he used STL, and Jeff decided
to, erm, "improve" it by moving whitespace around.)

Cute rewriting of C++ syntax is universally considered
as bad practice.
You mean like

#define Begin {
#define End ;}
#define While while(
#define Do ) {
#define Do2 {
#define Done ;}
#define Done2 );
#define Procedure
#define Function

? :-)

Agreed, that's going to leave a bit of a mess.
Don't take my word for it, c.l.c++.m (see above) is
a great resource - you have Stroustrup, Sutter,
Alexandrescu and their peers actively participating
in discussions there and offering ego-less advice.
Do they do STL in there?

Standards, conventions and idioms are good for a reason.
Any C and C++ programmer should recognize for(;;) at a glance.


I'll admit "pure" STL might frown on that, replacing it
with std::generate(), std::transform(), or std::for_each(),
but old habits die hard... :-)

--
#191, ew****@earthlink.net
It's still legal to go .sigless.
Jul 21 '05 #133
Bruce Wood wrote:
What most businesses want, whether they are selling software or
developing in-house, is something in between. They don't want piggish
software, but then neither do they want to be forced to hire geniuses
at $200K a year.


The folly of it all is that because they think there is some way out of
good solid work that they will spend $2 million or $200 million on
"application servers" that promise to deliver everythign with 'easy to
use' GUI interfaces, only to find that once you leave the seminar and
try to code something up with it, it's a hopeless mismash, slow and
cumbersome...of course, by then the IT Managers who bought it have gone
on to promtions because of their "cost-saving" decisions...

If they had spent the money on salaries to "gurus" -- that is, someone
above the moron level --they would get much greater return. But where
is the IT Leader who can speak up and say "hey, we should hire smart
people; most of them like to work, and will do a better job than all the
snake oil Big Software companies with their Pretty Sales Reps and UML
diagrams, and will create efficient, well writen code, if only we let
them have free sodas" ???

Jul 21 '05 #134
There are myriad problems with this.

1. There is only a limited number of gurus to go around.
2. Most gurus don't like writing boring business software.
3. This presumes that the hiring managers can tell which hires are
worth spending money on and which aren't. There is an equal number of
"snake oil salesmen" in the ranks of interviewees as there are selling
big software packages. I have many times worked for companies that
spent big bucks on "gurus" who were, in fact, total idiots who knew how
to sell themselves in an interview.
4. Today's stock-and-trade tools are yesterday's "snake oil." I
remember when relational databases were "snake oil" crap. Now we
wouldn't do without them. Yes, IT managers often fall for hype.
However, just as often "gurus" are stuck in the past. How many really
smart guys have you met who insist on writing everything in C and sneer
at modern tools? How effective do you think they are at writing the
kind of software businesses need?
5. One of those very, very smart gurus can write me up a business
report in C that is a model of beautiful design, all in only a couple
of days. Some jackass fresh out of college can cook up the same thing
in VB in two hours, and it interoperates neatly with all of MS's stuff,
to boot. Yes, the code is crap (I hate VB), yes, it could be much more
efficient (.NET practically guarantees bloat), but I'm going to throw
it away next month and ask for a different one. Who should I hire, do
you think? Different skill sets and languages lend themselves to
different problems. (I wouldn't hire the VB jackass to program a CAT
scanner, for example.)

I used to write real-time, multi-tasking software for telephone
switches. I absolutely do _not_ try to program business apps the same
way. My old job required hyper-efficient code, fine tuning, attention
to memory consumption, and estensive unit testing. My new job requires
short development cycles: get the product on the business user's desk
_fast_ without killing his PC or the network. It's a completely
different way of thinking.

I will give you one thing, though: my new company would do well to
search out someone who _really knows_ Microsoft's development world,
and pay that person a high salary to help the rest of us get up to
speed on architecture and design decisions in the context of MS's long
term plans.

Some guy who writes elegant C code would be utterly useless to us,
apart from his basic thinking skills and attention to detail.

Similarly, the aforementioned MS guru would completely suck writing
code in my old job, where picky attention to tiny details was the order
of the day, and you built every line of code by hand, counting CPU
cycles as you went. As I said: different domains, different skill sets.

The computing world has become so diverse that there is plenty of room
for the guys building little jewels of programs in C, and plenty of
room for the guys building business apps using Visual Studio, ADO.NET,
and SQL Server using drag-and-drop. We need them all, but for different
domains and different reasons. Gone are the days when one person could
do it all, where one skill set was enough to get you any "computer job"
anywhere you wanted to work.

Whether you like it or not, you're specialized, so don't go sneering at
some other guy with a different speciality just because he can't match
you in your domain. That kind of dismissive attitude toward other skill
sets is the refuge of the insecure.

Similarly, get used to what I call the 10 / 80 / 10 rule: 10% of the
programmers out there are "gurus" in some area who are leading the way
and understand what's what. 80% of the programmers out there understand
the basics and can get the job done. 10% of the programmers out there
have no idea what they're doing: they just copy and paste and then
tweak it until it works. In every industry you have to deal with all of
these types of people. If you're in the top 10% and you let the other
90% get to you then you _will_ go nuts. Guaranteed.

Jul 21 '05 #135
On Wednesday 06 April 2005 07:50, Sean Hederman
<em*******@codingsanity.blogspot.com> (<d3**********@ctb-nnrp2.saix.net>)
wrote:
Yes but the Linux kernel is also based on a 40-year old architecture
Your statement is more or less true but it's irrelevant. Saying Unix (or
Linux) isn't new doesn't say anything bad (or bad) about them. Linux is
certainly based, at least in part, on a design originally from the 1960s,
and its because the basic design is simple, useful, and effective. Unix
and Linux itself have both undergone major changes since their
originations.
so I suppose writing it in a 33-year old programming language> makes a
certain sick kind of sense...
Similarly, the C programming language is still in use because its basic
design is simple, useful, and effective for its intended purpose.
The thing is that C has it's place, but it's certainly not every place. If
you were to tell me that I should write business solutions using C, I'd
have to ask what you were smoking.


This is the "tab" argument, using the "solution" buzzword, but completely
lacking in detail. If performance is critical, and must be predictable,
languages like C (and C++) are indispensable. When these are not primary
considerations, C (or C++) may well be a bad choice.
Jul 21 '05 #136
Bruce Wood wrote:
There are myriad problems with this.

1. There is only a limited number of gurus to go around.
I think there are more than you might imagine; alternatively, there are
a lot of generally bright people who might find 'guruing' attractive if
IT management weren't always in the process of *dumbing* down IT work.
2. Most gurus don't like writing boring business software.
A guru is someone who would find a way to make it exciting. What would
turn the guru off is higher-ups who want to constantly kill ideas to
make it more exciting and innovative. For example, the web services/SOA
model could be applied to *so* much of business processing and it should be!
3. This presumes that the hiring managers can tell which hires are
worth spending money on and which aren't. There is an equal number of
"snake oil salesmen" in the ranks of interviewees as there are selling
big software packages. I have many times worked for companies that
spent big bucks on "gurus" who were, in fact, total idiots who knew how
to sell themselves in an interview.
It's always hard to find the Real Thing; but, I find that a company with
a glossy brochure and slick app server finds it easier to gain entry
than a person who wants to apply some real skills to the problem.
Reason: glossy brochures don't threaten the Estblishment. Smart people
do...
4. Today's stock-and-trade tools are yesterday's "snake oil." I
remember when relational databases were "snake oil" crap. Now we
wouldn't do without them. Yes, IT managers often fall for hype.
However, just as often "gurus" are stuck in the past. How many really
smart guys have you met who insist on writing everything in C and sneer
at modern tools?
Many...
How effective do you think they are at writing the
kind of software businesses need?
They would be excellent if given the chance to do it "their way".
5. One of those very, very smart gurus can write me up a business
report in C that is a model of beautiful design, all in only a couple
of days. Some jackass fresh out of college can cook up the same thing
in VB in two hours, and it interoperates neatly with all of MS's stuff,
to boot. Yes, the code is crap (I hate VB), yes, it could be much more
efficient (.NET practically guarantees bloat), but I'm going to throw
it away next month and ask for a different one. Who should I hire, do
you think? Different skill sets and languages lend themselves to
different problems. (I wouldn't hire the VB jackass to program a CAT
scanner, for example.)
The issue is the 'next time'. The c guy would find a way to abstract
and reuse his methods -- so he would constantly decrease his programming
turnaround time, and increase program speed and efficiency.

The VB would be static -- it will always take 2 hours and it will never
run any faster...

I used to write real-time, multi-tasking software for telephone
switches. I absolutely do _not_ try to program business apps the same
way.
I absolutely would. The realtime/SOA paradigm shift in business has
been a long time coming...business cannot and should not be doing even
the simpliest accounting in terms of years or months...it should be in
seconds....
My old job required hyper-efficient code, fine tuning, attention
to memory consumption, and estensive unit testing. My new job requires
short development cycles: get the product on the business user's desk
_fast_ without killing his PC or the network. It's a completely
different way of thinking.
And it's a great way of thinking...
I will give you one thing, though: my new company would do well to
search out someone who _really knows_ Microsoft's development world,
and pay that person a high salary to help the rest of us get up to
speed on architecture and design decisions in the context of MS's long
term plans.
You could substitute "linux kernel" for M$....

Some guy who writes elegant C code would be utterly useless to us,
apart from his basic thinking skills and attention to detail.
That is where we differ...

... The computing world has become so diverse that there is plenty of room
for the guys building little jewels of programs in C, and plenty of
room for the guys building business apps using Visual Studio, ADO.NET,
and SQL Server using drag-and-drop. We need them all, but for different
domains and different reasons. Gone are the days when one person could
do it all, where one skill set was enough to get you any "computer job"
anywhere you wanted to work.

Whether you like it or not, you're specialized, so don't go sneering at
some other guy with a different speciality just because he can't match
you in your domain. That kind of dismissive attitude toward other skill
sets is the refuge of the insecure.
That is the 'ecosystem' argument...and I agree with it...my diatribe is
that the 'intelligence' has been slowly squeezed out of the IT/Web
industry by people who think that writing an application generator or
server is what it's all about. It's not...it's about constant and rapid
change and the ability to modify and perfect at all levels...in any case

Similarly, get used to what I call the 10 / 80 / 10 rule: 10% of the
programmers out there are "gurus" in some area who are leading the way
and understand what's what. 80% of the programmers out there understand
the basics and can get the job done. 10% of the programmers out there
have no idea what they're doing: they just copy and paste and then
tweak it until it works. In every industry you have to deal with all of
these types of people. If you're in the top 10% and you let the other
90% get to you then you _will_ go nuts. Guaranteed.


Word.



Jul 21 '05 #137
On Wed, 6 Apr 2005 23:24:44 +0200, "Sean Hederman"
<em*******@codingsanity.blogspot.com> wrote in message
<<d3**********@ctb-nnrp2.saix.net>>:
Tried a couple of other newsreaders, didn't like them. Got any good
suggestions that run on Windows?


Graphical: SuperGravity (formerly: Gravity from Microplanet).
Console: SLRN (not to be outfeatured by anyone)

Jul 21 '05 #138

Hi Alex, Re:
#define mt( x, y ) MoveToEx( DC, x, y, 0 )
#define lt( x, y ) LineTo( DC, x, y )

You told me: << This is not good C++. Never was, never will be.
It may or may not be good C. >>

It makes my code less verbose. You say it's bad... but you can't say why.

Re: The following two macros, which I use a lot, and which C# can't do:
#define LOOP while ( 1 )
#define \
LoopTo( StopCond ) \
while ( Ch && ( Ch =3D ( uchar ) * ++ P \
, Ch2 =3D ( uchar ) P [ 1 ] \
, Ch ) \
&& ! ( StopCond ) )

You told me: << Gaak !
What's wrong with templates and inline functions ? >>

What inline function acts like while() ?

Did you bother to look at the code ? No-o-o you did not.

Re: My LowerCaseNG ( LnP Mixed ) code,

You told me: << 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. >>

Without even going to c.l.c++.m,
I'm sure that Stroustrup, Sutter, Alexandrescu have nothing to say,
that's why the group is moderated, to coverup that fact.

Although all code requires an investment to learn,
my code is very maintainable, I say.

You added: << I don't know who your employer is
but I would like mine to be so lenient. >>

I have the feeling that your employer is just as off as you are.

Re: My comment that Loop() is more readable than for(;;),
#define Loop( N ) int J = - 1, LLL = N ; while ( ++ J < LLL )

You told me: << More readable to who ?
Cute rewriting of C++ syntax is universally considered as bad practice. >>

Loop() is more readable to anyone than for(;;)
at least to anyone who invests the few minutes it takes to learn it.

Loop() does not change C's syntax.

Jul 21 '05 #139
> "Better code," then, depends upon the context in which that code is to
be used and maintained. In my environment, which is in-house
development for a milling company, my reaction to a devilishly tricky,
but lightning-fast business analysis program would be to toss it in the
trash and write a new one that was much slower but also much more
easily maintained. My company wants people here focused on solving new
business problems, not tweaking and tuning what we have until it's a
jewel of efficiency, and then spending big bucks maintaining the
result. Other companies do want that efficiency, even if it costs... it
all depends upon the problem domain.

So you can optimize for speed, and you can optimize for functionality and
you can optimize for fast changes and optimize for readibility and optimize
for group usage. :-)

Optimize for speed is nice for OS kernal and image processing tools.
Optimizing for functionality is for example adding plug-ins to extend the
program.
Optimize for fast changes could be a tax payment software that must change
every year according to the new rules.
Optimize for readability for other people for example if the program is
created by a contractor, and next time he is unavailable, someone else must
be able to extend the program.
Optimize for group usage, is to make other people use your library to
develop their programs.

Most of the times it is imposible to have all of those in one program.

Jul 21 '05 #140
> There are myriad problems with this.

1. There is only a limited number of gurus to go around.
2. Most gurus don't like writing boring business software.
3. This presumes that the hiring managers can tell which hires are
.......


I fully agree with you on this.
It appears that you have a lot of experience in this.

The use of language is basedon what is needed in that domain.
And in my opinion, a good programmer will use the tools he has available at
that time for that job.

Although I do admit, that since I have background of assembler and
electronics, I would not like creating VB programs.
So I tend to stay on the Delphi/C++/C# side of the road. And I would also
tend to create a library of classes to do the things, so no fast hacks in my
case. But other people my prefer the VB side and databases. It is developer
dependend.
Jul 21 '05 #141

Hi Spooky, Ya writ: << At some point one would hope for an employer that
can at least attempt to read C++ code, Java code -- heck, any code,
or maybe run a code analyzer to find the more common bugs. >>

Automated code analyzers are futile,
Code is as it does, only testing finds bugs.

Jul 21 '05 #142

Hi Bruce_Wood, Re: The kind of code you want,

What programs do you have that run too slow ? None, I'll bet.

And even if you did have speed concerns,
they probably could be solved by just upgrading your LAN,
internet connection, hard drive, DVD burner, printer, etc.

I also bet that you don't spend endless years/money perfecting GUIs,
....second, or even third class, will do,
so C#'s dialog/forms editors are quite good enough for you.

As far as maintaining code... upgrades, bug fixes, etc.,
there's always a learning curve, even with C#.

From showing my code, for example my HTM_TXT.CPP,
which demos how my X.CPP converts HTML files into plain_text files:
http://www.Cotse.NET/users/jeffrelf/HTM_TXT.CPP
I found that no one here was willing to take the time to learn
my standard methods... which is totally understandable.

But I also found that no one here could produce anything half as good.
I think that's because the STL and C# make people lazy,
they tend to rely on the built-in stuff too much.

Jul 21 '05 #143
Jeff_Relf wrote:
But I also found that no one here could produce anything half as good.


Man, you really have created your own little fantasy here, haven't you?
Jul 21 '05 #144
Olaf Baeyens wrote:
"Better code," then, depends upon the context in which that code is to
be used and maintained. In my environment, which is in-house
development for a milling company, my reaction to a devilishly tricky,
but lightning-fast business analysis program would be to toss it in the
trash and write a new one that was much slower but also much more
easily maintained. My company wants people here focused on solving new
business problems, not tweaking and tuning what we have until it's a
jewel of efficiency, and then spending big bucks maintaining the
result. Other companies do want that efficiency, even if it costs... it
all depends upon the problem domain.


So you can optimize for speed, and you can optimize for functionality and
you can optimize for fast changes and optimize for readibility and optimize
for group usage. :-)

Optimize for speed is nice for OS kernal and image processing tools.
Optimizing for functionality is for example adding plug-ins to extend the
program.
Optimize for fast changes could be a tax payment software that must change
every year according to the new rules.
Optimize for readability for other people for example if the program is
created by a contractor, and next time he is unavailable, someone else must
be able to extend the program.
Optimize for group usage, is to make other people use your library to
develop their programs.

Most of the times it is imposible to have all of those in one program.


Is your name really 'Olaf' ?

Jul 21 '05 #145
> Is your name really 'Olaf' ?

Yes, why would you believe that it would not be?
Jul 21 '05 #146
>
But I also found that no one here could produce anything half as good.
I think that's because the STL and C# make people lazy,
they tend to rely on the built-in stuff too much.


I hope at least someone could write more readable code, your example is VERY
unreadable.

Use some {}'s and don't put them on the same line as any code.
That would make your code a lot more friendly towards other developers.

/Søren
Jul 21 '05 #147
> > But I also found that no one here could produce anything half as good.
I think that's because the STL and C# make people lazy,
they tend to rely on the built-in stuff too much.
I hope at least someone could write more readable code, your example is

VERY unreadable.

Use some {}'s and don't put them on the same line as any code.
That would make your code a lot more friendly towards other developers.

Yes but that slows down the compiler, because it has to process all the
blanks and CR and LF characters.
And it is less performant because you need additional bytes to store these
addtional blinks and CR and LF chracters too, so you have less memory, less
disk space, and that would be not a proof that you be able to create fast
code. ;-)

Just kidding!!!

I do know from experience that some programmers think that creating
one-liners are faster programs, but I have done enough reverse engineering
by looking at the actual created assembler code, and I do know that it is
simply not true. Sometimes the one-liner created additional hidden temp
variables slowing it down. Everything depends on your compiler quality.
Jul 21 '05 #148

Hi Olaf_Baeyens ( and Sean_Hederman ),
Re: My LowerCaseNG() which converts a Copy of a string like
"Alt.OS.Windows-XP, Comp.OS.Linux.Advocacy"... removing all the spaces,

You showed me: << string name = "Alt.OS.Windows-XP, Comp.OS.Linux.Advocacy";
Console.Write(name.ToLower()); >>

That's not a copy and the spaces are still there.

At any rate, that was a poor example of my LoopTo() macro,
below is a better one... oh, and by the way,
the flexibility/readability of macros is what I demand... not speed.

Decode the following from 7-bit to 8-bit,
for example, following the UTF-8_B, UTF-8_Q, and iso-8859 standards
( a space has been added before the first ? to disable conversions )
= ?UTF-8?B?MTIzNDU2Nzg5XzEyMzQ1Njc4OV8xMjM0vw==?=
= ?utf-8?Q?=70=69=75=73=20=70=72=69=63=65?=
= ?iso-8859-1?Q?Lin=F8nut?=

Note, UTF uses two 8-bit chars, so just going to 8-bit once is not enough,
a line might well require two passes.
Various decoding methods are required, including Base64.

Here are the standards that I'm demonstrating:
#define LOOP while ( 1 )
#define Loop( N ) int J = - 1, LLL = N ; while ( ++ J < LLL )
#define \
LoopTo( StopCond ) \
while ( Ch && ( Ch = ( uchar ) * ++ P \
, Ch2 = ( uchar ) P [ 1 ] \
, Ch ) \
&& ! ( StopCond ) )
#define Eq ! strcmp
#define Eqi ! stricmp
#define EqN ! strncmp
#define EqiN ! strnicmp

typedef char * LnP ; typedef unsigned int uint ;

int rv;

__inline int RaisC ( LnP P ) { return * P = toupper( * P ); }

int HexToN( int C ) { if ( isdigit( C ) ) return C - '0' ;
if ( RaisC ( ( LnP ) & C ) >= 'A' && C <= 'F' )
return 10 + C - 'A' ; return -1 ; }

__int64 ER ( __int64 X, __int64 Y ) { return X > Y ? X : Y ; }
__int64 er ( __int64 X, __int64 Y ) { return X < Y ? X : Y ; }

This is my 7 bit to 8 bit converter to demonstate the above standards:

LnP _7_to_8( LnP _7 ) { static LnP B; static int Sz_B ;
rv = ER( 200, strlen ( _7 ) + 1 );
if ( Sz_B != rv ) { free ( B ); B = ( LnP ) malloc( Sz_B = rv ); }
strcpy( B, _7 );
LOOP { P = B ; int Repeat = 0 ;
LOOP { int Ch = 1, Ch2 = 0 ; int UTF_8 ;
LoopTo (
Ch == '=' && Ch2 == '?'
|| ( UTF_8 = ( Ch == 194 || Ch == 195 )
&& ( Ch2 & 0xC0 ) == 0x80 ) );
if ( ! Ch ) break ;
if ( UTF_8 ) { memmove( P, P + 1, E -- - ( P + 1 ) + 1 );
* P = ( Ch & 3 ) << 6 | Ch2 & 0x3F ; continue; }
LnP T = P ; P += 2 ;
if ( ! Repeat ) Repeat = EqiN( P,"UTF-8", 5 );
LoopTo ( EqiN( P, "Q?", 2 ) || EqiN( P, "B?", 2 ) );
if ( ! Ch ) break ;
int Q = EqiN( P, "Q?", 2 ); P += 2 ;
memmove( T, P, E - P + 1 ); E -= P - T ; P = -- T ;
uint X, By, Cnt ; X = By = Cnt = 0 ; T = P ;
LoopTo ( Ch == '?' && Ch2 == '=' )
if ( Q ) {
if ( Ch == '=' ) {
Ch = HexToN( Ch2 ); Ch2 = HexToN( P [ 2 ] ) ;
if ( Ch >= 0 && Ch2 >= 0 ) { * P = Ch * 16 + Ch2 ;
memmove( P + 1, P + 3, E - ( P + 3 ) + 1 ); E -= 2 ; } } }
else { X <<= 6 ; X |= A_63 [ Ch ]; if ( Ch != '=' ) By ++ ;
if ( ++ Cnt < 4 ) continue;
LnP XP = ( LnP ) & X ; XP += 3 ;
Loop( By * 6 / 8 ) * ++ T = * -- XP ; X = By = Cnt = 0 ;
memmove( T + 1, P + 1, E - ( P + 1 ) + 1 );
E -= P - T ; P = T ; } if ( ! * P ) break;
memmove( P, P + 2, E - ( P + 2 ) + 1 ); E -= 2 ; }
if ( ! Repeat ) break ; } return B ; }

// A_63 is a sparsely populated table
// to convert from Base64's ( MIME ) printable ASCII characters
// ( A-Z, a-z, 0-9, +, / ) to integers between zero and 63.
// _63_A goes the other way.

char A_63 [ 'z' + 1 ], _63_A [ 64 ];

main() { LnP CC = "Aa0+/"; int X = -1 ;
Loop( strlen ( CC ) ) {
int L = J > 2 ? 1 : J == 2 ? 10 : 26 ; char C = CC [ J ] - 1 ;
Loop( L ) A_63 [ _63_A [ X ] = ++ C ] = ++ X ; }

// Note the space before the first ? must be removed by hand
// before testing.

printf( "%s",
, _7_to_8( "= ?UTF-8?B?MTIzNDU2Nzg5XzEyMzQ1Njc4OV8xMjM0vw==?= "
"= ?UTF-8?B?MTIzNDU2Nzg5XzEyMzQ1Njc4OV8xMjM0vw==?=" ) );
printf( "%s",
, _7_to_8( "= ?utf-8?Q?=70=69=75=73=20=70=72=69=63=65?= "
"= ?utf-8?Q?=70=69=75=73=20=70=72=69=63=65?=" ) );
printf( "%s",
, _7_to_8( "= ?iso-8859-1?Q?Lin=F8nut?= "
"= ?iso-8859-1?Q?Lin=F8nut?=" ) ); LOOP; }

Except for the main(), the above code is from X.CPP:
http://www.Cotse.NET/users/jeffrelf/X.CPP

You showed: <<
int swapped=(((byte) iOriginal)) << 24 | ((byte) (iOriginal >> 8)) << 16 |
((byte) (iOriginal >> 16)) << 8 | ((byte) (iOriginal >> 24)); >>

Good work, but you can't inline that in C#,
C++ allows me to inline select functions ( using __inline )
even when I'm debugging ( using the complier's /Ob1 switch ).

Speaking of that, C++ can link with the non-debug CRT/LIBs
and still have all the debugging options I need.

Did you try my version in C#... and did it work ? :

typedef unsigned char * uint_8_P ;

int Swap_32 ( int X ) { uint_8_P P = ( uint_8_P ) & X + 4 ;
return * -- P << 24 | * -- P << 16 | * -- P << 8 | * -- P ; }

main() { printf( "%x", Swap_32( 0x84838281 ) ); }

I ask because the above code does not work in MS_C_7_1,
and I think it's a bug... it doesn't evaluate the four -- P decrements
left to right like it should... it decrements them all at once, like P -= 4 ;

Re: The way Outlook wrapped your code,

40tude_Dialog lets you marks lines you don't want wrapped.
My hyper-custom newsreader, X.EXE,
never automatically wraps anything... as a rule.
( all wrapping must be done manually )

Nevertheless, You could've just wrapped it yourself, like this:

90 mov eax,esi // eax=iOriginal
92 and eax,0FFh // (byte) iOriginal ( converting int to byte )
97 shl eax,18h // (byte) iOriginal<< 24
9a mov edx,esi // edx=iOriginal
9c sar edx,8 // iOriginal >> 8
9f and edx,0FFh // ((byte) (iOriginal >> 8))
a5 shl edx,10h // ((byte) (iOriginal >> 8)) << 16
a8 or eax,edx // ((byte) iOriginal)) << 24
// | ((byte) (iOriginal >> 8)) << 16
aa mov edx,esi // edx=iOriginal
ac sar edx,10h // iOriginal >> 16
af and edx,0FFh // ((byte) (iOriginal >> 16))
b5 shl edx,8 // ((byte) (iOriginal >> 16)) << 8
b8 or eax,edx // ((byte) iOriginal)) << 24
// | ((byte) (iOriginal >> 8)) << 16
// | ((byte) (iOriginal >> 16)) << 8
ba mov edx,esi // edx=iOriginal
bc sar edx,18h // iOriginal >> 24
bf and edx,0FFh // ((byte) (iOriginal >> 24)
c5 or eax,edx // ((byte) iOriginal)) << 24
// | ((byte) (iOriginal >> 8)) << 16
// | ((byte) (iOriginal >> 16)) << 8
// | ((byte) (iOriginal >> 24)
c7 mov ebx,eax // copy to the swap variable.

You concluded: << So very compact in my opinion.
Also note not temporary memory values, pure register operations
SO LIGHTNING FAST!!!!!

If you would check C++ code then you will also see something like this.
There goes the mystery that C# would be slower ! ! ! ! It is not !
And I even didn't use the unsafe keyword ! Pure managed. >>

That is amazing.

You wrote: << iOriginal=Class1.Swap_32(iOriginal); translates to:
15 mov ecx,esi
17 call dword ptr ds:[009750E0h]
1d mov edi,eax
1f mov esi,edi

static public int Swap_32(int iOriginal) {
return (((byte) iOriginal)) << 24 | ((byte) (iOriginal >> 8)) << 16 |
((byte) (iOriginal >> 16)) << 8 | ((byte) (iOriginal >> 24)); }

This translates to:

00 push ebp
01 mov ebp,esp
03 sub esp,8
06 push edi
07 push esi
08 mov esi,ecx
0a xor edi,edi
...
0c mov eax,esi
0e and eax,0FFh
13 shl eax,18h
16 mov edx,esi
18 sar edx,8
1b and edx,0FFh
21 shl edx,10h
24 or eax,edx
26 mov edx,esi
28 sar edx,10h
2b and edx,0FFh
31 shl edx,8
34 or eax,edx
36 mov edx,esi
38 sar edx,18h
3b and edx,0FFh
41 or eax,edx
43 mov edi,eax
...
45 jmp 00000047
47 mov eax,edi
49 pop esi
4a pop edi
4b mov esp,ebp
4d pop ebp
4e ret

So in this case you have the expected overhead of
executing a call and setting up a stack. >>

Very interesting... thanks. But as I said above,
only macros give me the flexibility/readability that I demand,
....I'm not so concerned about speed.

Jul 21 '05 #149

Hi Olaf_Baeyens ( and Soren_Reinke ),

The way I use whitespace is the most readable to me, of course,
and I expect you to change it to taste too.

Speed was never my concern.

An added benefit is that this allows me to track where I've been reading,
as the whitespace there will have changed.

Jul 21 '05 #150

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by tada991 | last post: by
22 posts views Thread by Ramzy Darwish | last post: by
11 posts views Thread by Sam | last post: by
269 posts views Thread by Montrose... | last post: by
15 posts views Thread by Alex L Pavluck | last post: by
6 posts views Thread by Jamiil | last post: by
5 posts views Thread by vinnie | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Purva khokhar | last post: by
1 post views Thread by haryvincent176 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.