The true advantage of C# over C++
-
no
_T()
, bug@"c:\temp"
I mean, really.
Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers!
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
Linkify!|Fold With Us! -
no
_T()
, bug@"c:\temp"
I mean, really.
Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers!
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
Linkify!|Fold With Us!Does C# have the equivalent of the C/C++ #define? If so, you could just do a #define _T() (which I find almost as clumsy to type as @""). :)
Author of The Career Programmer and Unite the Tribes www.PracticalStrategyConsulting.com
-
Does C# have the equivalent of the C/C++ #define? If so, you could just do a #define _T() (which I find almost as clumsy to type as @""). :)
Author of The Career Programmer and Unite the Tribes www.PracticalStrategyConsulting.com
No. C# is natural elegance ;-)
-
no
_T()
, bug@"c:\temp"
I mean, really.
Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers!
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
Linkify!|Fold With Us!:) prop [tab] [tab] obj.someevent += [tab] [tab] It's awesome!
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
Currently working on C++/CLI in Action for Manning Publications. (*Sample chapter available online*) -
:) prop [tab] [tab] obj.someevent += [tab] [tab] It's awesome!
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
Currently working on C++/CLI in Action for Manning Publications. (*Sample chapter available online*)If you install VS SDK or the lastest power tools, you get the same feature for C++\CLI.
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -Brian Kernighan
-
Does C# have the equivalent of the C/C++ #define? If so, you could just do a #define _T() (which I find almost as clumsy to type as @""). :)
Author of The Career Programmer and Unite the Tribes www.PracticalStrategyConsulting.com
Christopher Duncan wrote:
Does C# have the equivalent of the C/C++ #define?
Yes and no -- yes you can alias types and no you cannot do what you just posted. You can do a class-wide #define in this sense:
using IntList = System.Collections.Generic.List<int>;
But it applies only to the current class. Other classes will see your IntList as the good old List<int>. Another limitation is, it's only a type alias. You cannot alias things like keywords or language-specific symbols, which I think is a great way to keep people from writing abominations like this[^] or this[^]. :-)
Tech, life, family, faith: Give me a visit. I'm currently blogging about: God-as-Judge, God-as-Forgiver The apostle Paul, modernly speaking: Epistles of Paul Judah Himango
-
Does C# have the equivalent of the C/C++ #define? If so, you could just do a #define _T() (which I find almost as clumsy to type as @""). :)
Author of The Career Programmer and Unite the Tribes www.PracticalStrategyConsulting.com
I use the "C pre-processor" with my C#, I'm just that kind of guy. So yes, I have the same
# define
. (And I compile from the command-line... with a bat file, although I suppose make can do it too.)"C:\Program files\mingw\bin\cpp" -include "C:\Projects\PIEBALD\Defines.hs" -P -C -D__Csharp=# -w %1.cs %1.csi
csc.exe @"C:\batfiles\Build.rsp" %1.csiWhen I do want the C#
# define
, which is very rare, I write__Csharp define
instead. This is mostly from years of using Pro*C; I'd pass the code through CPP (or equivalent), then through the Pro*C pre-compiler, and then into the C compiler. The downside is that my line numbers are off by one, but I can live with that. -
no
_T()
, bug@"c:\temp"
I mean, really.
Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers!
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
Linkify!|Fold With Us!Haven't used
_T()
in a while :) (yeah, Linux...) Anyway, if you ask me, the true advantage of C# over C++ is that it is developed by Microsoft, and not the "Standard Comitee". Heck, they (MS) managed to turn a joke that C# 1.0 was into the most advanced mainstream language[^] (this story about MS products getting decent around version 3.0 seems to have something about it after all) and we are still hoping that type inference and lambdas will get adopted by the Standard around 2010 if we are lucky, and then it would take another 5 years for the compiler vendors to catch up :mad: Well, at least we have real destructors :)
-
Haven't used
_T()
in a while :) (yeah, Linux...) Anyway, if you ask me, the true advantage of C# over C++ is that it is developed by Microsoft, and not the "Standard Comitee". Heck, they (MS) managed to turn a joke that C# 1.0 was into the most advanced mainstream language[^] (this story about MS products getting decent around version 3.0 seems to have something about it after all) and we are still hoping that type inference and lambdas will get adopted by the Standard around 2010 if we are lucky, and then it would take another 5 years for the compiler vendors to catch up :mad: Well, at least we have real destructors :)
Nemanja Trifunovic wrote:
Well, at least we have real destructors
:laugh:
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
Currently working on C++/CLI in Action for Manning Publications. (*Sample chapter available online*) -
Does C# have the equivalent of the C/C++ #define? If so, you could just do a #define _T() (which I find almost as clumsy to type as @""). :)
Author of The Career Programmer and Unite the Tribes www.PracticalStrategyConsulting.com
Anyway
_T()
and@""
are not doing the same thing._T()
doesL""
for Unicode, nothing for ANSI, whereas@""
allows you to do raw strings (strings that don't process escape characters). In C# you don't have to fool with single- vs. double-byte strings because they are all double byte. You can do the same in a C++ program by usingwstring
andL""
and then you don't neeed the ugly_T()
macro. However, I don't know of any way to do raw strings in C++. Yes, C# does have a limited#define
, but it -- thankfully -- doesn't do macros. It is just for#ifdef
/#ifndef
kind of stuff.Matt Gerrans
-
Just make the builds unicode. :~ Assuming you don't have the misfortune of supporting braindead win9x OSs...
-- Transmitido en Martian en SAP
-
Just make the builds unicode. :~ Assuming you don't have the misfortune of supporting braindead win9x OSs...
-- Transmitido en Martian en SAP
Joergen Sigvardsson wrote:
Just make the builds unicode.
It has been a long time, but doesn't in Unicode builds
""
still produce ANSI strings?L""
is a Unicode string:#ifdef _UNICODE #define _T(str) L#str #else #define _T(str) str #endif
or something like that.
Luis Alonso Ramos Intelectix Chihuahua, Mexico
Not much here: My CP Blog!
-
Just make the builds unicode. :~ Assuming you don't have the misfortune of supporting braindead win9x OSs...
-- Transmitido en Martian en SAP
-
Joergen Sigvardsson wrote:
Just make the builds unicode.
It has been a long time, but doesn't in Unicode builds
""
still produce ANSI strings?L""
is a Unicode string:#ifdef _UNICODE #define _T(str) L#str #else #define _T(str) str #endif
or something like that.
Luis Alonso Ramos Intelectix Chihuahua, Mexico
Not much here: My CP Blog!
Yes, you'll need the L prefix, but that is in my opinion a minor peeve compared to _T().
-- Please rise for the Futurama theme song
-
:) prop [tab] [tab] obj.someevent += [tab] [tab] It's awesome!
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
Currently working on C++/CLI in Action for Manning Publications. (*Sample chapter available online*)But Nish! That's you, aka "the C++.NET guy"! But yes, you make an absolutely important point. Languages today are judged not just inside the domain of "programming languages in general/theory", but how well they work together with IDE tools.
Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers!
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
Linkify!|Fold With Us! -
no
_T()
, bug@"c:\temp"
I mean, really.
Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers!
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
Linkify!|Fold With Us!5 words, and a full spelling bug :doh:
Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers!
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
Linkify!|Fold With Us!