Click here to Skip to main content


AnswerRe: error while trying to uplaod the file in current directory using c language PinmvpRichard MacCutchan30-Jan-13 22:03 
AnswerRe: error while trying to uplaod the file in current directory using c language Pinmember«_Superman_»1-Feb-13 20:34 
QuestionTCP/IP CAsyncSocket and pointers to same Pinmemberbkelly1324-Jan-13 15:16 
Answerclasses don't call upwards Pinmemberbkelly1326-Jan-13 8:55 
After writing the OP I outlined the process with all the steps then began to implement.
I have started using a common directory for re-usable code. In order for the Manager to call a method in its creator it must know the name of the owner's class.   To do that I added a forward declaration in the Manager.
However, this means that when the class is re-used, and the owner has a different name, the Manager must be changed.  
There is another indicator this is a bad practice.   After the forward declaration in the dot H file, the dot CPP file needs to reference the dot H file of the owner. The common code resides in another directory and it cannot find the central code of the main project unless it is specifically spelled out.   Then, if the project is moved or re-name, the common code must change.
There may be a way to do this automatically using directive and path names within Visual Studio.   But I now think that even if that can be done it would be miss-guided.
A utility class can call "down" the heiarchy to objects it creates, but should not call up to its owner.   While the concept of it calling up may make the owner code neater, it represents an inversion of authority. (Regardless of how the methods are name, a call up in an inversion.)
Problems remain:
The main application uses pointers into the lower level objects to accomplish its tasks.   How does it become aware that the lower level needs to exit, or maybe even has already exited.
Controlled exits:
When the TCP sending function detects that the client has closed the connection it does not exit right away.   It waits until the upper level code calls the method to send the data.   Then the lower level returns an error code stating that the data has not been sent and that the object is exiting.
Uncontrolled exits:
I generally do not like exceptions, but this appears to be a time when an exception is warranted.   When the lower level must terminate unexpectedly, then an exception could work its way back to the upper level and the exception handler can NULL the pointer.
Thanks for your time
QuestionATL and exceptions Pinmemberimagiro14-Jan-13 8:10 
AnswerRe: ATL and exceptions PinmemberJonathan Davies18-Jan-13 9:39 
AnswerRe: ATL and exceptions Pinmemberbkelly1324-Jan-13 15:24 
GeneralRe: ATL and exceptions PinmemberJonathan Davies6-Feb-13 7:23 
GeneralRe: ATL and exceptions PinmemberAlbert Holguin11-Feb-13 5:12 
Questionunicode and non-unicode Pinmemberbkelly1314-Jan-13 3:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Advertise | Privacy | Mobile
Web02 | 2.8.140902.1 | Last Updated 25 Aug 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid