Certain currently popular
programming languages (such as C++) are highly efficient but can easily bring about memory errors, and certain currently popular
programming languages (such as
Java) are safe in memories but lower in efficiency. The invention discloses an object-based
programming method and an object-based programming
system in C language programming, and the
system is a convenient, safe and high-efficiency programming framework. The
system utilizes the stack technique to efficiently judge the attribute of an 'object' (i.e. a non-generic
type variable), also standardizes assignment and other operations on the object, and can release object resources and optimize the efficiency of object usage (or the efficiency of parameter transfer) simultaneously. The system provides defining templates for objects and object-operating functions, so that programmers can conveniently define the objects and the object-operating functions, the objects and functions defined by the defining templates can be conveniently subjected to recursionrecur and can be conveniently nested, invoked and operated in any other complex ways like generic type variables and functions, and the problems of
memory safety and efficiency are automatically processed by the templates.