c# is a good way to learn c

J

Jeff_Relf

Hi Greg_Cox, Re: CodeWright, You wrote: <<
I'm unfamiliar with a debugger by them so I can't comment. >>

You used MicroSoft's debugger then, I assume, MS_DevStudio... Right ?
( or Visual_Studio )

Visual_Studio_Net_2003 allows On_The_Fly macros,
I hit F7 to start/stop recording and then F8 to play it.
The so_called quick_Macro can then be edited, if I want,
to create a VBA script ( to assign it to a key or toolbar icon ).

Holding down the Alt and the Shift keys and then moving the text cursor
( via the mouse or keys ) allows me to select a block of text,
....instead of sequential characters.

You can assign a name to your keybindings file, I call mine Key_Bindings.VSK
Below is the .BAT file I use to save off my Visual_Studio settings.
Save_Setngs.BAT:

C:
cd "C:\Documents and Settings\Owner\Application Data\Microsoft\VisualStudio\7.1"
REM Must exit VS to save CmdUI.PRF and Key_Bindings.VSK

XCopy /Y /F 1033\CmdUI.PRF F:\VS
XCopy /Y /F Key_Bindings.VSK F:\VS
XCopy /Y /F devenv.xml F:\VS
XCopy /Y /F "C:\__\Visual Studio Projects\VSMacros71\MyMacros\__.vsmacros" F:\VS
XCopy /Y /F C:\__\X\VS.REG F:\VS
XCopy /Y /F C:\__\X\VS.VB F:\VS
XCopy /Y /F C:\__\X\Save_Setngs.BAT F:\VS
XCopy /Y /F C:\__\X\Restore_Setngs.BAT F:\VS
XCopy /Y /F C:\__\X\Bit_Stream.TTF F:\VS

Pause

REM More info at:
REM http://blogs.msdn.com/jledgard/archive/2004/02/05/67869.aspx

Below is how I restore them to another machine, when I have the privileges.
Restore_Setngs.BAT:

XCopy /Y /F CmdUI.PRF "C:\Documents and Settings\BLab-242\Application Data\Microsoft\VisualStudio\7.1\1033"

REM Key_Bindings must be selected by hand.

XCopy /Y /F "Key_Bindings.VSK" "C:\Documents and Settings\BLab-242\Application Data\Microsoft\VisualStudio\7.1"
XCopy /Y /F devenv.xml "C:\Documents and Settings\BLab-242\Application Data\Microsoft\VisualStudio\7.1"
XCopy /Y /F __.vsmacros "C:\__\Visual Studio Projects\VSMacros71\MyMacros\__.vsmacros"
rem XCopy /Y /F __.vsmacros "C:\Documents and Settings\blab-242\My Documents\Visual Studio Projects\VSMacros71\MyMacros\__.vsmacros"
VS.REG

Pause
 
L

Lee Marvin

Alex said:
I am not aware of any signifigant amout of *new* development done in
COBOL.
Of course, maintenance is a whole different story.

That is because like every other fool around here, you have no idea what
runs corporate information systems...your only schooling is the PC
sandbox, so you assume that IIS and Sql Server actually do any real work.


http://www.infogoal.com/cbd/cbdhome.htm
 
L

Lee Marvin

Greg said:
I'm not sure what that would get them. You're talking about hundreds of
thousands to millions of lines of existing C/C++ code. Why would they
want to dump that and start over?

LOL.

Ok, so then that argument applies to each and every application that
might consider .NET
 
L

Lee Marvin

Alvin said:
Is that opinion? fact? general consensus? blind guess? ...

exactly...Da Vinci was a loser most of whose 'inventions' were to crappy
to be built or work right.
 
C

Christoph Nahr

Look guys, if this clown can't stop trolling could you at least stop
responding to his idiocy? Perhaps he'll get bored and go away...
 
R

Richard Blewett [DevelopMentor]

Yes it does.

Anyone who suggested to a company to take their existing application that is fit for purpose and completely rewrite millions of lines of code *purely* so it runs on .NET should be shot.

However, often existing applicaiton reach the end of the road (maybe the business it weas built have changed and the architecture can't support the new requirements without a substantial rewrite) and become due a rewrite naturally or large sectrions of it anyway. So a more common case is for a full or partial rewrite to occur then.

Also completely new requirements of projects emerge and these get written in managed code.

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Greg said:
I'm not sure what that would get them. You're talking about hundreds of
thousands to millions of lines of existing C/C++ code. Why would they
want to dump that and start over?

LOL.

Ok, so then that argument applies to each and every application that
might consider .NET

[microsoft.public.dotnet.languages.csharp]
 
J

Jeff_Relf

Hi Rose_Mountain, Easy one, Rose_Mountain.CPP prints: <<
On the first day of Christmas my true love gave to me
a partridge in a pear tree. ... >>

Only I'd write it like this:
#include <stdio.h>
FILE * fp ;

Recurse ( int t, int _, char * a ) {
return
1 < t
? t < 3
? Recurse ( -79, -13, a + Recurse( -87, 1 - _
, Recurse ( -86, 0, a + 1 ) + a ) )
: 1, t < _
? Recurse ( t + 1, _, a )
: 3 , Recurse ( -94, -27 + t, a ) && t == 2
? _ < 13
? Recurse ( 2, _+ 1, "%s %d %d\n" )
: 9
: 16
: t < 0
? t < -72
? Recurse ( _, t,
"@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l,+,/n{n+"
",/+#n+,/#;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l q#'+d'K"
"#!/+k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i"
";# ){nl]!/n{n#'; r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#n'wk "
"nw' iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c "
";;{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}+;"
"#'rdq#w! nr'/ ') }+}{rl#'{n' ')# }'+}##(!!/" )
: t < -50
? _ == * a
? fwrite ( a + 31, 1, 1, fp )
: Recurse ( -65, _, a + 1 )
: Recurse ( ( * a == '/' ) + t, _, a + 1 )
: 0 < t
? Recurse ( 2, 2 , "%s")
: * a == '/'
|| Recurse ( 0
, Recurse ( -61, * a
, "!ek;dc i@bK'(q)-[w]*%n+r3#l,{}:\nuwloca-O;"
"m .vpbks,fxntdCeghiry" ), a + 1 ); }

main() { fp = fopen( "AA.TXT","w"); Recurse ( 1, 0, "" ); fclose(fp); }
 
J

Jeff_Relf

Hi Montie, You imagined: << There should be plenty of people at M$ right now
working to port everything to .Net/Indigo and so on,
...making all their products in c# >>

Right... and there should be trees that grow hundred dollar bills too.

I can see it now:
DOS_Prompt_> Mono MS_Word.EXE

That's just never going to happen.
 
J

Jeff_Relf

Hi Eran_Kampf, Re: How I won't use C# because it doesn't have #define,
You told me: << Funny thing is, 10 years ago there were assembly developers
talking about C and C++ the same way you take about C#. >>

C++ is as high_level as I want it to be because I can always add a DLL.

But C#, with it's Program_Inside_a_Program, lack of #define
and UnGodly_Bloat are a straightjacket I refuse to wear.
 
S

Sean Hederman

Lee Marvin said:
exactly...Da Vinci was a loser most of whose 'inventions' were to crappy
to be built or work right.

Da Vinci is regarded as one of the greatest geniuses of all time. When they
try to figure out the IQ's of historical figures based on their works, the
estimate for Leonardo's is consistently off the charts. He came up with
inventions that were so far ahead of their time, that often the reason they
didn't work was the materials available to him. Recently a group of
scientits built a spring loaded car that he designed. It worked. He produced
the first robot, designs for helicopters (wouldn't work), gliders (would
work), machine guns, tanks (built recently & worked), and a submarine. He
was able to write both normally and in mirror-writing. He was one of the
worlds most accomplished artists ever, and was regarded as a master of
anatomy.

All this in 1452-1519, 486 years ago. Here's a challenge, why don't you come
up with *one* feasible design that will only be possible to built in 2491AD,
and that would be in common use then?

http://en.wikipedia.org/wiki/Leonardo_Da_Vinci
 
S

Sean Hederman

Christoph Nahr said:
Look guys, if this clown can't stop trolling could you at least stop
responding to his idiocy? Perhaps he'll get bored and go away...

Yep, already killfiled him.
 
S

Sean Hederman

Richard Blewett said:
Anyone who suggested to a company to take their existing application that
is fit for purpose
and completely rewrite millions of lines of code *purely* so it runs on
.NET should be shot.

No! Such a strategy would involve murdering hundreds of thousand of the
PHB's who religiously jump on the latest bandwagon...

....

....

Um, okay.

Can I be one of the executioners? Should we do this en-masse, or one at a
time? The efficient part of me says all at once, but I really, really,
really want to see the whites of their eyes.

"Decided to migrate a perfectly good mainframe app to Java, AFTER Y2K"
*bang!*
"Switched development platform 3 times before development was complete"
*Bang!*
"Decided that development tools choice is a marketing function" *BANG!*
*BANG!!* <machine gun fire> <mortar fire>
"Wants the desktop graphics editing tool to 'implement SOA'" <artillery,
tanks, thousand of Gurkhas shouting>
"Wants to rewrite Windows-only product in C++ from .NET so 'we can be
cross-platform' when no customers/potential customers want this" <nuclear
strike> -> this one happened to me, so I'm a bit twitchy.
"Wants to write internal system with complex screens and rich UI
requirements in one honking big ASPX with no purchased controls, in 5 days"
<armageddon> -> also happened to me :-(
 
R

Richard Blewett [DevelopMentor]

So why are you posting here?

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Hi Eran_Kampf, Re: How I won't use C# because it doesn't have #define,
You told me: << Funny thing is, 10 years ago there were assembly developers
talking about C and C++ the same way you take about C#. >>

C++ is as high_level as I want it to be because I can always add a DLL.

But C#, with it's Program_Inside_a_Program, lack of #define
and UnGodly_Bloat are a straightjacket I refuse to wear.


[microsoft.public.dotnet.languages.csharp]
 
O

Olaf Baeyens

Sounds like the next step is for these groups to write Office in c#.
I'm not sure what that would get them. You're talking about hundreds of
thousands to millions of lines of existing C/C++ code. Why would they
want to dump that and start over?
My guess is more security, and one code executable that runs on 64 bit, 32
bit, Itanium,....
Also .NET programs are far more modular in design and thus easier to change.

But it won't happen overnight.
 
A

Alvin Bruney [MVP - ASP.NET]

That's good enough for me.

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc
 
O

Olaf Baeyens

Well I did promise to do the C++ test to see what would be the difference
in code generated by C#+JIT and unmanaged C++ for you function.
My prediction would be that it would come close to the unmanaged C++ and
here is what I found. So the myh that C# would create less performant code
than C++ because of the virtual machine is now proven to be incorrect.

Losing perfomance is probably not caused by C# itself but the liraries used
and the way how the programs are designed.
I don't know about the Mono compilers, I don't have it to test it.
Personal tests suggests that my C# programs are about 5% slower than
unmanaged C++ programs, but my user interface is far more rich, so that
could explain the loss of speed. Also there is a psychological impression
that C# programs are slower because they load slower. The loading is slower
because of the JIT that compiles the code and doe ssecurity checks. bu once
loaded it is fast.

This is the C++ version (not optimized since I have the standard edition
which has no optimizing). But with my understanding of assembler I predict
that the optimized code would still look very close to what we have here
because it is already very optimized.
Both the C# and C++ are compiled with VStudio 2003 standard.edition

#define byte unsigned char
int iOriginal=0x01234567;
int iSwapped=(((byte) iOriginal)) << 24 | ((byte) (iOriginal >> 8)) << 16 |
((byte) (iOriginal >> 16)) << 8 | ((byte) (iOriginal >> 24));

Generates assembler like this:

00000011 mov eax,esi
00000013 and eax,0FFh
00000018 shl eax,18h
0000001b mov edx,esi
0000001d sar edx,8
00000020 and edx,0FFh
00000026 shl edx,10h
00000029 or eax,edx
0000002b mov edx,esi
0000002d sar edx,10h
00000030 and edx,0FFh
00000036 shl edx,8
00000039 or eax,edx
0000003b mov edx,esi
0000003d sar edx,18h
00000040 and edx,0FFh
00000046 or eax,edx
00000048 mov edi,eax

As you remember (my previous post) the C# version that got compiled to ILASm
,and later from ILAsm to real processor instructions by the JIT did create
this:

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

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.

Have a nice day. :)
 
J

Jim Trice

Michael said:
Hear, hear! And in 1959 there were people talking that way about Fortran.

BTW, I have no idea about telling Picasso what kind of paint to use. But
Leonardo da Vinci, a much greater artist, eagerly tested any kind of paint
he could get his hands on. As I recall, frescoes came out of his
experiments, or were much improved by them.

Fresco is rather older than that, the Romans used to use it. Leonardo had
no training in fresco painting, which is why he experimented instead of
using more traditional techniques. One of the least successful experiments
of his career. Frescos are amongst the most durable forms of painting, as
the pigments are incorporated in the plaster as it drys. Some of them even
survived Pompeii. But Leonardo's were painted on the wall in layers, and
were showing serious decomposition in less than 20 years.
 
L

Lee Marvin

Jeff_Relf said:
Hi Montie, You imagined: << There should be plenty of people at M$ right now
working to port everything to .Net/Indigo and so on,
...making all their products in c# >>

Right... and there should be trees that grow hundred dollar bills too.

I can see it now:
DOS_Prompt_> Mono MS_Word.EXE

That's just never going to happen.

Beagle which is written in mono will the be the desktop search standard.

So, yes, it will.
 
?

=?iso-8859-1?Q?Lin=F8nut?=

tab poked his little head through the XP firewall and said:
You are a guy that wants to debate which flavor M & M tastes better.
You think "your way" is the BEST way. I am the guy cleaning up your
death march project that failed, and trashing your crap that took
10 times as long to code, with 30X more bugs,

What exaggeration!

Especially where you seem to claim that you can clean up any kind of
project.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top