2013年12月28日 星期六

Implementations of singleton in C.

Singleton is usually an important and necessary pattern, no matter in any programming languages, for developing flows. The point which is cared here, is if the property could be assured consisted, could be checked by compiler.

2013年12月10日 星期二

Another private problem in C.

Rather than the private property in the C structures, the optional-private property(or usually be called as namespace) is more interesting and suffering. The situation might be, there is a big system, which contains several subsystems, each has its own interfaces to be accessed by the other subsystems, or the application if it is a library. Beside the interface, there are also some implement helper functions which are expected to be called only within the subsystem, such as callback functions, helper functions, reused code fragments... etc. As a simple example, say we have a subsystem handles socket stuff:

2013年12月5日 星期四

Private members in C.

    As being a language with great possibilities, almost every concepts, no matter old or new, could be implemented by C. A quite common difficulty would be the private member in C, especially when offering a library for co-working. Here are some notes about doing the private-like members in the C structs.