From: Ajay Kalra on 13 Mar 2008 09:59 On Mar 12, 10:49 pm, "Tom Serface" <tom.nos...(a)camaswood.com> wrote: > The only thing I don't like about C# is no #define macros. I miss that > feature from C++. > C# has no preprocess, so it doesnt make sense to have this. You can however have conditional compilation symbols using #define, #undef etc. --- Ajay
From: Joseph M. Newcomer on 13 Mar 2008 10:10 Actually, you only need one class for strings, CString. In very rare and exotic circumstances where you need to be aware of the character set differences, you can use CStringA or CStringW. std::string is largely irrelevant for MFC programmers. _T() is just part of the standard syntax. By the way, does C# have a way to convert to UTF-8 and back? joe On Wed, 12 Mar 2008 21:13:27 +0100, "Giovanni Dicanio" <giovanni.dicanio(a)invalid.com> wrote: > >"Tom Serface" <tom.nospam(a)camaswood.com> ha scritto nel messaggio >news:B45FAA0F-4660-4D86-ACCA-B4226F8B5C7A(a)microsoft.com... >> Yeah, C# just always does Unicode. No _T() or TCHAR or L"" or anything. >> That is nice. > >...and not several classes for strings, like std::string, std::wstring, >CString, CStringA, CStringW, LPCTSTR, wchar_t*, char*... > >Just *string* :) > >Yes, that is nice. > >G > Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Joseph M. Newcomer on 13 Mar 2008 10:14 Up to a certain point, const declarations and generics will help. But every once in a while, having a code-generator integrated into the compiler system is useful, such as #define TYPECASE(x) case x: return _T(#x); break and similar techniques. In the absence of good macros, tricks like this become difficult, although the C# ToString function handles the above situation trivially, it doesn't generalize to situations such as #define TYPECASE(x) case x: s.LoadString(IDS_#x); return s where localization is necessary. Since C# seems to embed all the literals int he code instead of in resources, I find this doesn't help a lot (what is the opposition to dialog templates, STRINGTABLE, MESSAGETABLE, etc. in C#?) joe On Wed, 12 Mar 2008 19:49:10 -0700, "Tom Serface" <tom.nospam(a)camaswood.com> wrote: >The only thing I don't like about C# is no #define macros. I miss that >feature from C++. > >Tom > >"Ajay Kalra" <ajaykalra(a)yahoo.com> wrote in message >news:1E8ACCDC-68B5-4C9F-9E56-5FB0EC54D2B8(a)microsoft.com... >> >> "Tom Serface" <tom.nospam(a)camaswood.com> wrote in message >> news:B45FAA0F-4660-4D86-ACCA-B4226F8B5C7A(a)microsoft.com... >>> Yeah, C# just always does Unicode. No _T() or TCHAR or L"" or anything. >>> That is nice. >> >> No macros is good. No header files is better. >> >> --- >> Ajay >> >> Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Bob Moore on 13 Mar 2008 10:44 On Wed, 12 Mar 2008 11:15:03 -0500, Joseph M. Newcomer <newcomer(a)flounder.com> wrote: >One >of the few places this could be confusing is in the Register API, which very much says >"bytes", and does leave it up to the programmer to realize that a REG_SZ read into a >Unicode app really does require "bytes" as the API states. Yes, I remember the string registry apis as being an example. It would be nice if they'd named parameters as xxxBytes or xxxElements, but that of course would have required perfect foresight. Bob Moore http://bobmoore.mvps.org/
From: Tom Serface on 13 Mar 2008 11:00
Yeah, I know the reasons. I just miss the functionality. Old habits. Tom "Ajay Kalra" <ajaykalra(a)yahoo.com> wrote in message news:608f8210-120e-4297-9790-ef1b6d2093e9(a)e60g2000hsh.googlegroups.com... > On Mar 12, 10:49 pm, "Tom Serface" <tom.nos...(a)camaswood.com> wrote: >> The only thing I don't like about C# is no #define macros. I miss that >> feature from C++. >> > > C# has no preprocess, so it doesnt make sense to have this. You can > however have conditional compilation symbols using #define, #undef > etc. > > > --- > Ajay |