Thread: New core
View Single Post
Old 01-23-2004, 08:40 AM  
darkone's Avatar
Join Date: Dec 2001
Posts: 2,230

Originally posted by NorLan
hmmmm d1 if you say so much about how good the code is - i come to the conclusion to buy a source code license one day

and if it is just to stick sheets of the printed code all around in my flat *gg
I've learned over time, that best way to write code is to use several layers and store variables inside structures.


1st layer: VOID TransmitPackages(LPSOCKET lpSocket, LPIOBUFFER lpBuffer, DWORD dwBuffers, VOID (*lpCallBack)(LPVOID, DWORD), LPVOID lpContext);
2nd layer: TranmistPackages_Update(), TranmistPackage_xxx(), TranmistPackage_Timer() (where xxx = package type)
3rd layer: QueueJob(), StartIoTimer(), StopIoTimer(), ioSend(), ioRecv(), ioReadFile(), ioWriteFile(), ioCloseSocket(), Allocate(), Free()
4th layer: Windows API calls

For variables, I usually use structures:

typedef struct _SOCKET
SOCKET Socket;

Also, bitwise flags are a must They allow adding extra parameters without need of rewrite any of the high-level code
darkone is offline   Reply With Quote