Menu

#15 Reduce circular references

Future Release
closed
David
complexity (1)
5
2020-01-29
2020-01-22
No

I have started to replace my own Win32 class library with Win32++ and found that circular references in the header files make it difficult for me to upgrade the code step by step. So far I have noticed especially the MIN and MAX macros and StrCopyA(), StrCopyT() and StrCopy() functions (they are declared in "wxx_appcore0.h"/defined in "wxx_appcore.h" and trigger a circular reference since MAX is used in "wxx_cstring.h" and CString is used in "wxx_appcore0.h"; and since StrCopy() is used in "wxx_exception.h" and CFileException is used in "wxx_file.h" and subsequently CFile requires access to g_msg... string constants defined in "wxx_appcore0.h"). In addition to that I suggest to rework/move the g_msg... string constants in order to habe the possibility to provide internationalization.

Discussion

  • David

    David - 2020-01-23

    Hi Steffen.

    Thanks for your interest in Win32++. I take issue with your terminology though. Technically speaking, Win32++ does not have "circular references" as such. It does have header files which include other header files, but that's to be expected in C++ code. These inclusions are hierarchical, not circular.

    If I understand correctly, you've described some of the issues you've experienced trying to break the Win32++ code down to its component parts. Perhaps it would help to understand Win32++ in terms of core features and optional features. The core features should be treated as a set. Each optional feature can be treated in isolation.

    It is the wxx_wincore.h header which contains or includes the full set of core features which are used by the rest of the library. These core features are defined in several files, but they are all included when we include wxx_wincore.h. The main core features are:
    - CCriticalSection
    - CException
    - CWinThread
    - CWinApp
    - CWnd
    - CDC

    Some useful utilities are also included by wxx_wincore.h, such as:
    - CString
    - Text conversions (AtoT, TtoA etc.)
    - Safe string copy functions (StrCopyA, StrCopyT, StrCopy)
    - CRect, CPoint, CSize
    - MIN and MAX macros
    - some global functions

    Anything that's not defined in or included by wxx_wincore.h is optional. We can choose whether or not to use them. The optional features will utilise at least some of the features from the core set.

    Best regards,
    David

     
  • David

    David - 2020-01-29
    • status: open --> closed
    • assigned_to: David
     

Log in to post a comment.