Added package with the documentation and the examples
[lwc.git] / CHANGES
blobb985cf3c5277c95846dd68efbe8dbf1e2b03bb90
1 version 1.4 (Crazy Baboon)
2 ==========================
4 - '!!' operator removed.
6 - See doc/newdocs/10.0-new-in... for the new stuff
8 - [GOOD] The "key function" method is used to emit virtual tables:
9   The file in which the first not-inlined, non-auto function is defined,
10   will be the file that includes the virtual table of the class.
11   If no key function exists, the virtual table is emitted as static in all
12   files.  This also applies for 'static class { ... };'
14 - [low-level FEATURE] __on_throw__ statement which allows more control over
15   exceptions
17 - [NEW] goto (...) ? label1 : label2
19 - [NEW] integer virtual variables can be initialized with |= and &=
21 - [NEW] global function(s) named 'ctor' are called before main.
23 - [low-level FEATURE] turn switches into address tables.
25 - [NEW] we can overload 'new' and 'delete' for classes to provide
26   custom object allocators.
28 - [NEW] aliases. Member functions can be aliases for other
29   functions. That is more interesting for auto-functions.  As in:
30         void xprint () alias (print);
32 - [IMPROVEMENT] in many cases lwc now uses aliases (with
33    ``__attribute__((alias ("func")))'').  This is frequent in
34   auto functions that dispatch to their parent, destructors, etc.
35   The result is faster/less code.
37 - [IMPROVEMENT] 'delete' may have an object for an argument (not a
38   pointer to object).  This is used in the case of virtual destructors
39   to say that the object's type is known and the virtual call will
40   be avoided.
41                 A *a;
42                 delete a;       // virtual call to dtor
43                 delete *a;      // direct call to A_dtor_()
45 - [NEW] '__inset__' pseudo-function which check whether a value
46   is one of its constants with a switch.
48 - [NEW] '__unwind__' can appear in a *class declaration*.
49   Such a class will always be registered for __unwind__ when local
50   objects are declared.  This is important because we can easilly
51   emulate C++ without the use of gcc's cleanup attribute.
52   Moreover, lwc does an analysis to see if exceptions may be thrown
53   and it will not emit unwind-code for code paths where exceptions
54   will definitelly not occur.  Attribute 'nothrow' implemented too.
56 - [CHANGED] 'final' is made a reserved word.  It can appear before a
57   class declaration to tell that none of the class's virtual functions
58   will be overriden in derrived classes (or that the class will not
59   derrive).  As in:
60         final class B : A { ... };
62 - [CHANGED] exceptions throw a 'void*' pointer instead of an integer
63   value. We can now throw objects (as in 'throw new Foo (1,2)').
64   However, we will still need to implement our own typeid (which
65   is easy though as _v_p_t_r_ is exposed to userland).
67 - [FIXED] static local variables with constructors are moved out
68   of the function and constructed only once before main ().
70 - [IMPROVED] lwc now accepts 'long' as a unique type. Before, 'long'
71   was converted to 'int' because it was believed that these two are
72   the same.  However, in "modern" 64-bit CPUs 'long' is used to denote
73   64bit integers and int 32bit.
75 - [CHANGED] destructors call destructors of parent classes as C++.
76         struct D1 { virtual ~D1 () { printf ("~D1\n"); } };
77         struct D2 : virtual D1 { ~D2 () { printf ("~D2\n"); } };
78         struct D3 : virtual D1 { ~D3 () { printf ("~D3\n"); } };
79         struct D4 : D2, D3     { ~D4 () { printf ("~D4\n"); } };
80         int main ()
81         {
82                 D1 *d = new D4;
83                 delete d;
84         }
85    shall print  ~D4, ~D2, ~D3, ~D1
86    This does not happen for destructors declared 'auto'.  These dtors
87    only call the 'internal destruction' function which dtors any data
88    members that need destruction and arrange the destruction of the
89    parent's parents recursively, obeying the above rules.  Double check
90    the generated code if you use auto dtors.
92 - [CHANGED] 'new' has a higher priority than '->' and therefore "new A->x"
93   first invokes 'new' and then gets the member.
95 - [NEW] Power VarArgs.
97 - [FEATURE] it's safe to compare typeids.
99 - [NEW] _v_p_t_r_ exposed to userland and allows for type mutation.
101 - [BUGFIX] virtual inheritance with pure virtuals was partly broken.
103 - [FIXES] tons of fixes for pure typedefs and auto functions.
105 version 1.3.2
106 =============
108 - Changed the generated code for the gcc cleanup attribute so that if a 
109   constructor throws, the destructor is not invoked. As in the simple case
110   where we don't have the cleanup attribute and like C++.
112 version 1.3.1
113 =============
115 - [REGRESSIONS] most tests in Samples/ no longer compiled!
116   The one problem was that the function stat() was considered a 'declaration
117   expression' constructing a temporary object 'struct stat'. Typical
118   problem.
119   The other regression is that with the new schema with exceptions, setjmp.h
120   is automatically included and that means that all headers'd better be in
121         extern "stdio.h" {
122         #include <stdio.h>
123         }
124   segments.
126 - [CHANGE] The 'switch value' feature has been changed to 'switch
127   (declaration)' feature. For example:
128         switch (int x = foo (bar())) {
129         }
131 - [IMPROVE] no dtors are emitted if a compound statement ends in 'return',
132   'break', 'continue' or 'goto'.
134 version 1.3
135 ===========
137 - [FEATURE] 'typeid' a special virtual variable which is automatically
138   initialized with the name of the class.
140 - [FEATURE] gcc's 'cleanup' attribute. Very useful. If lwc is compiled
141   with gcc 3.4 this is enabled by default.  It has two major implications.
143         1) Code for the destruction of local objects is automatically
144            generated by the compiler.  lwc produces less code.  it also
145            works with 'goto'!
147         2) cost-free exception cleanups.  If the generated C code is
148            compiled with -fexceptions, destructors of all local objects
149            are invoked when exceptions are raised.  like c++
151 - [CHANGE] switched from 'setcontext' to 'setjmp' for exceptions.
152   'throw 0;' does no longer re-do the try statement.
154 - [FEATURE] pure typedefs and consequently pure data members.
155   Generic programming can now be done with auto-functions instead.
157 - [BUGFIX] auto-functions using class-typedefs in their arguments
158   have been improved.  Everything works better now.
160 - [BUGFIX] programs using __unwind__ while a context was not prepared
161   by a 'try' would segfault.
163 - [BETTER] when local class typedef used and the type is a simple type,
164   we emit the simple type name in the output, like 'int', etc,
165   rather than the confusing TyPeDeF_ name.
167 - [GOOD] lwc understands __builtin_expect.
169 - [FEATURE] declaration expressions of temporary objects.
171 version 1.2
172 ===========
174 - [**ATTN**] forcing overloaded operator calls. The syntax has been
175   changed. If you used parentheses to force an operator overload, you should
176   fix the code. Now -> is used before the operator to to it. For example:
177                 a (+) b
178   should be changed to:
179                 a ->+ b
181 - [FEATURE] modular data members. Same as C++'s static data members.
183 - [BUGFIXES] usual set. Tons of tiny corner-case bugs fixed.
185 - [FEATURE] auto-functions are redefined on the use of local typedefs.
186   That can lead to some extent of generic programming. see doc 8.1
188 - [BUGFIX] don't call constructor for global objects declared 'extern'
190 - [BUGFIX] 'linkonce' specifier on global functions would cause an
191   embarassing segmentation violation.
193 - [FEATURE] non-virtual functions can be pure. This is only useful for
194   auto functions because we don't emit code for an auto function that
195   calls a pure function. (compile-time polymorphism)
197 - [GOOD] no code is emitted for auto-functions that call pure functions.
198   Those functions are, too, considered pure and the procedure goes on
199   recursively to eliminate all the auto-function code that may
200   never be called.
202 - [FEATURE] calling member functions from specific parent classes can
203   be done with the syntax 'class.func()'. This is a shortcut for the
204   casts that were previously used '((class*)this)->func()'.
206 - [BUGFIX] modular functions called directly (not through vptr), had
207   a problem with their first argument for which no conversions were done.
209 - [NEW] Long break/Long continue.  Break out of more than one nested
210   loops with proper destruction of locals.
212 - [GOOD] not only object names but also typedef'd object names can be
213   used in 'new', inheritance and other places. This is very useful for
214   'typedef specialize'. Sample:
215         template class T {
216         virtual X vv;
217         modular X f ()  { return _CLASS_.vv; }
218                 X i;
219                 T () {}
220         };
221         typedef specialize T { typedef int X; } O;
222         int O.func ()
223         {
224                 return i;
225         }
226         class A : O {
227                 int flk;
228         };
229         int main ()
230         {
231                 O o;
232                 new O;
233                 O.vv = 12;
234                 O.f ();
235                 A a;
236         }
237   That's right.
239 - [NEW] declaration specifier '__unwind__'. Local objects declared
240   with this are destructed on 'throw'. Info on 3.2-exceptions
242 - [CHANGE] we do not call destructors of static local objects when
243   their scope closes.
245 - [KEWL] now lwc throws a warning if we forget the semicolon after
246   the declaration of a class (very common mistake)
248 version 1.1
249 ===========
251 - [NEW] enum by name. Generate enum name strings for integer
252   values with __enumstr__(ENUM_TAG, value)
254 - [BETTER] static functions are not placed in linkonce
255   sections.
257 - [FEATURE] attribute 'final' for virtual functions.
259 - [CORRECTION] references should invoke virtual calls and not
260   direct member calls. Other fixes for structures passed by
261   reference resulting in virtual stuff (for example access of
262   virtual base's members in virtual inheritance).
264 - [BUGFIX] auto functions were not cooperating with the "derrived
265   objects without data members" optimization.
267 - [FEATURE] template classes can have real-class ancestors. These
268   are inherited in specializations.
270 - [NEW] Variable length arrays (VLA) are transformed to alloca().
272 - [FIX] The name of a local object can be used in its initialization
273   expression. For example:
274         int i = sizeof i;
276 - [GOOD] added some useful informative warnings in code generation
278 - [BUGFIX] in the conversions of ?: to bring the expressions
279   to a common type. If one is a pointer and the other an int,
280   the resulting type is a pointer.
282 - [BUGFIX] several fixes for 'specialize' in local scopes.
283   It had only been tested for global specializations.
285 - [BUGFIX] modular member functions which were defined outside the
286   body of their class, could not call other modular functions of
287   the class!
289 - [IMPROVEMENT] regular expressions can use strncmp/strncasecmp
290   for long fixed strings. Makes code smaller.
292 - [BUGFIX] in regular expression code generation.
293   A '&&' should be '||' somewhere.
295 - [FEATURE] function call () operator can be overloaded.
297 - [FEATURE] anonymous struct objects supported like anonymous
298   union objects.
300 - [BUGFIX] nested anonymous union objects didn't work.
302 - [RIGHT-THING] in the previous version, operator overloading for
303   postfix unary operators (++, --, !!), was not fully implemented.
304   We use the -already- reserved keyword 'postfix' to declare these.
306 - [RIGHT-THING] assignments in initializations are converted
307   to constructor calls.
309 version 1.0
310 ===========
312 - [FEATURE] construction of each element of array of objects
313   with ctors. see 6.2-doc
315 - [FEATURE] single-quoted strings
317 - [FEATURE] it's possible to assign structures with const
318   members. Normally, the C compiler will complain for changing
319   value of read-only member. lwc uses memcpy for such assignments.
321 - [BETTER] The pointer to the virtual table
322   is declared const and cannot be altered in the lifetime of an
323   object. This is good becase the compiler may be able to optimize.
325 - [DESIGN] An important design decission.
326   lwc will adapt to the compiler it was compiled with and produce
327   code suitable for it. We would like to generate one portable
328   works-for-all C99 code, but unfortunatelly this is utopic.
330 - [FEATURE] if overloaded operators (except unary '*')
331   are applied on "this", overloading function is called.
333 - [FEATURE] references and the dereference() unary operator
335 - [NEW] regular expression to C code expander
337 - [NEW] postfix
339 - [FEATURE] escape raw strings with r"string"
341 - [RIGHT] global initialization constructor function not emitted if
342   not used. Also, we use the __attribute__ ((constructor)) thing to
343   register the global construction function instead of the obsolete
344   __section__ (".ctors")
346 version 0.9
347 ===========
349 - [FEATURE] linkonce data
351 - [FEATURE] some amazing optimizations which improve the generated
352   C code quality.  virtual inheritance can be really gone if derrived
353   objects have no data. see doc
355 - [FEATURE] alternative constructors
357 - [FIX] virtuallity pseudo functions which downcast,
358   now get a name which includes both classes. (should be so)
360 - [NEW] 'modular' member functions that don't have "this"
362 - [NEW] _CLASS_ keyword to be used with macros and auto
363   functions.
365 - [RIGHT-THING] function () const in the declaration
366   is passed to the definition.
368 - [REWRITE] of function namespaces code.  Now everything
369   is much better and we can easilly add more new things,
370   inherited specifiers/qualifiers, et all.
372 - [MISC BUGFIXES] in autofunction
374 - [FEATURE] keyword 'specialize' for
375   unique specialization of template classes according to their
376   local typedefs.
378 - [NEW] lwc program can now do C preprocessing.
379   Thus it is independent of the system's preprocessor
380   'cpp' and has the #uses directive to read header
381   files. Still, the system's preprocessor is more
382   portable and used by default.
384 - [BUGFIX] for some invalid expressions with missing
385   operands, lwc would not handle them correctly and
386   would use uninitialized data.
388 - [NEW] operator overloading on -> implemeted
390 - [CHANGE] best virtual table to add new entries
391   is the most recently created one. logically.
393 version 0.8
394 ===========
396 - [FIXES] many fixes in function overloading resolution, type promotion, etc.
398 - ** [NEW] Generic Programming with template classes + local typedefs
399   - functions of template classes can be declared outside their class.
401 - [FEATURE] class declaration qualifiers
402   apply to all member functions. This undoes the
403   older feature to place 'static' infront of a class
404   declaration to force definition of virtual table.
406 - [RIGHT-THING] destructors return 'this'.
407   The return value is used by free() in delete.
408   This is the right thing for proper destruction
409   in virtual/multiple inheritance.
411 - [FEATURE]
412   functions returning structures can be arguments
413   to functions receiving structures -- by reference.
415 - ** [NEW] Operator overloading. rewrite of the rexpr.c
417 - [DONE] references
418   functions can return references, which are lvalues.
420 - [FORGOT] to update the version number
422 - [CHANGED] the "mEmBeR" post string is really gone. member
423   function names are <function>_<object>_ which is rare-enough
424   and nicer.
426 - [NEW] the '!!' postfix/prefix operator for boolean negation.
428 - [NEW] portability project. lwc can reinclude files for the
429   C compiler to make the code portable.
431 - [RT] class consts can be used to initialize array members
432   bitfields and virtual variable initialization expressions.
434 - [FIX] yet more fixes in the code which decides if autofuncs
435   are the same and need redefinition or not.
437 version 0.7.1
438 =============
440 - [BUGFIX]
441   using uninitialized value maybe_ctor. thanks valgrind!
443 - [CHANGED]
444   auto functions are redefined if they reference 'this'
446 version 0.7
447 ===========
449 - [NOTICABLE]
450   linkonce linker sections where discovered and used.
451   This is very useful for several reasons:
452         - virtual tables don't have to be seen by main.
453           they are defined in every object file.
454         - Virtuallity functions which make up the virtual
455           table entries are collapsed (the executable is
456           eventually smaller).
457         - this allows the implementation of templates and
458           the auto functions
460 - [NEW] __thread is a valid storage class specifier
462 - [NEW] Exceptions
463   As a mechanism to a structured setjmp/longjmp implementation.
464   see doc/EXCEPTIONS
466 - [BUGFIX] the "return" statement will generate some
467   more code to call the destructors of all the local objects.
468   In the case of a function returning void, the generated
469   code was broken and syntactically invalid.
471 - [RIGHT-THING/FEATURE]
472   In multiple inheritance if a virtual function redeclared
473   exists in multiple parent classes, it is adjusted for both.
475 - [FEATURE]
476   In the gnuC extension of conditional operator ?: with omitted
477   middle operand: it is made to work with automatic casts in
478   inheritance.
480 - [NEW] the cool feature advertised, that it is possible
481   to define member functions without a declaration in the class
482   was not actually working. It is implemented because it's a
483   good idea.
485 - [RIGHT-THING]
486   If a virtual function calls itself recusivelly, the call does
487   not have to go through the virtual table. It knows which function
488   is called at compile-time.
490 - [BUGFIX] embarassing segfaults
491   -if arguments were named in declarations of virtual functions!
492   -in ambiguous member functions (isancestor)
494 - [COOL] auto virtual functions. See the NEW-0.7 for this great
495   extension.
497 - [NEW] binary enum
498   the benum declarator will generate constants like enum but
499   with binary exponential succession. 1, 2, 4, 8, 16, 32, ...
500   which can be used for boolean flags.
502 - [NEW] _loadtext <filename>
503   WIth this directive, lwc will read an entrie text file and
504   convert it to a string literal, escaping \" and \n.
505   Null terminate it and quote it.
507 - [NEW] parameter name may be omitted in function definitions
509 - [NEW] anonymous unions: they are supported
511 - [NEW] typeof() is a valid lwc keyword
513 - [NEW] for (int i;) implemented
515 - [NEW] The ability to request the generation of a const/inlined
516   virtual table has been improved.
518 - [RIGHT-THING] Downcasting and upcasting from null pointer (0),
519   results to null pointer (0) again; it should be so.
522 version 0.6
523 ===========
525 - [CRITICAL] Bugfix. Downcast data which was position dependent
526   was completely broken therefore.
528 - [CRITICAL] expressions in { initializers } were not rewritten!
530 - [BUGFIX] segfaulting in default argument list declarations.
532 - [BUGFIX] automatic casting in "return expression;" was not working properly
533   in inheritance.
535 - [BUGFIX] It used to be impossible to call redeclared virtual functions
536   in multiple virtual inheritance from a base object which was
537   not a pointer! (whatever that means)
539 - [FIXED] Fixed the case where a virtual call must be done for structures
540   passed by reference. These are actually pointers and not objects
541   so we go through the virtual table and call the pointer to function.
543 - [FIXED] automatic casting to common base class is also done for relational
544   operators (used to be in ?: only)
546 - [REWRITE] Major rewrite of the hierarchy module. Now everything is
547   simpler, easier to understand and more efficient. (simple is the enemy of
548   complex)
550 - [REWRITE] The code for naming all the arguments of function prototypes
551   has been rewritten, significantly improved and simplified.
553 - [IMPROVED] "virtual tables done right".
554   The virtual tables are now declared with lots of nested unions so that
555   the order of declaration does not matter.  Virtual tables are also
556   smaller.
558 - [IMPROVED] in virtual inheritance,
559   compile-time polymorhism is detected to generate constant paths.
560   Internal construction functions are smaller && faster.
562 - [RIGHT-THING] if a virtual base class has no data members (only a virtual
563   table) then virtual inheritance is much more efficient. The derrived
564   class has a direct pointer to the virtual table instead of a pointer to
565   the base class instance. g++ appears to be doing something like that too.
567 - [RIGHT-THING] Now the virtual table declarations and the structure declarations
568   are mixed in the same section. This is required because of virtual
569   variables: A virtual variable may be a structure and thus, virtual
570   table declarations can no longer be *before* the structure declarations.
572 - [CHANGED] The generated names of member functions where changed. Now it is:
573   <function-name>_<structure-name>_mEmBeR which is more descriptive.
575 - [NEW] _lwc_config_ {} command to pass options to the lwc compiler.
576    Interesting options : turn off structure-by-reference,
577    inline virtual tables by default, and other.
579 - [NEW] virtual tables can be constant and into read-only memory.
580   also constness applied to some internal  functions.
581   it's possible to declare 'const *this' for member functions.
583 - [NEW] const class members
585 - [NEW] abstract template class macros.
587 - [NEW] access of virtual variables without an instance.
589 - [NEW] introduced "static class" to export the virtual table definition.
591 - [NEW] overloaded operator ~
593 - [NEW] anonymous object call constructor thing.
595 - [NEW] Virtual inheritance declarations.
596   Solve the dynamic_cast problem
598 * see the file doc/CHANGES-0.6 for the new stuff.