good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Name another language that's completely and 100% backwards compatible after a major version upgrade. Look. C++ is quite compatible with C89 in the sense that most C89 programs you could think of would compile in C++ and produce identical behaiviour. It's not "completely and 100% backwards compatible", but I think it's at least as compatible as perl6 would be with perl5 (I'd bet this even on this stage of p6). It's a bit OT, but for those of you who know C++ well, it's worth to think of a way to write a program that does something different in C89 and C++, work reliably and portably in both, but not in some obvious way like checking for a macro that only one of them defines. I know of four ways but all of them use sizeof. The first uses the fact that apostrophe char-literals are of a different type in C and C++. The second uses that the visibility of a type declared inside a structure is different. The third uses the fact that struct labels are optional in C++ but not in C. The fourth is the only one that's my own invention:
I'd like to see a way to do this without sizeof. I couldn't figure out any even with the help of this list: http://david.tribble.com/text/cdiffs.htm. If you know any, please tell me. Also C99 is quite compatible with C89. (On the other hand, C89 is not that compatible with original K&R C, nor is C++ compatible with C99.) In reply to Re: Why Perl 6 is taking so !@#$ long
by ambrus
|
|