Author Topic: About CC: typedef problem  (Read 11339 times)

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
About CC: typedef problem
« on: June 03, 2009, 07:53:16 am »
Code
#ifndef _ATL_CSTRING_NO_CRT
typedef CStringT< wchar_t, StrTraitATL< wchar_t, ChTraitsCRT< wchar_t > > > CAtlStringW;
typedef CStringT< char, StrTraitATL< char, ChTraitsCRT< char > > > CAtlStringA;
typedef CStringT< TCHAR, StrTraitATL< TCHAR, ChTraitsCRT< TCHAR > > > CAtlString;
#else  // _ATL_CSTRING_NO_CRT
typedef CStringT< wchar_t, StrTraitATL< wchar_t > > CAtlStringW;
typedef CStringT< char, StrTraitATL< char > > CAtlStringA;
typedef CStringT< TCHAR, StrTraitATL< TCHAR > > CAtlString;
#endif  // _ATL_CSTRING_NO_CRT

#ifndef _AFX
typedef CAtlStringW CStringW;
typedef CAtlStringA CStringA;
typedef CAtlString CString;
#endif

typedef CAtlString CString;
Not work!
but CAtlString is ok!

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: About CC: typedef problem
« Reply #1 on: June 03, 2009, 08:05:30 am »
What do you mean by "not work"? :D
Please give a more specific details.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: About CC: typedef problem
« Reply #2 on: June 03, 2009, 12:48:05 pm »
What do you mean by "not work"? :D
Please give a more specific details.
CC can't show the parser word. nothing!

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: About CC: typedef problem
« Reply #3 on: June 04, 2009, 05:54:49 am »
The complex "template" typedef before
Code
typedef CAtlStringW CStringW;
typedef CAtlStringA CStringA;
typedef CAtlString CString;
may cause the problem.

The parser may failed parsing these template declaration.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.