On Mon, Sep 28, 2009 at 12:35 PM, bearophile <bearophileh...@lycos.com> wrote:
> Beside the known ones, like computed gotos and __builtin_expect(), GCC has 
> other less known extensions, you can find some of them here:
> http://www.ibm.com/developerworks/linux/library/l-gcc-hacks/
>
> They are used by Linux. If D wants to be a system language, such small things 
> may be useful if you want to build a kernel with D.
>
> One of them is the Range extension, it seems GCC devs think that 3 points are 
> better after all:
>
>        switch (major_idx) {
>        case 0:
>                return SCSI_DISK0_MAJOR;
>        case 1 ... 7:
>                return SCSI_DISK1_MAJOR + major_idx - 1;
>        case 8 ... 15:
>                return SCSI_DISK8_MAJOR + major_idx - 8;
>        default:
>                BUG();
>                return 0;
>        }
>
>
> Triple points can be used for initializations too:
> int widths[] = { [0 ... 9] = 1, [10 ... 99] = 2, [100] = 3 };
>
>
> The __builtin_return_address() looks interesting, but I don't understand 
> where it can be useful.
>
>
> The Constant detection done with __builtin_constant_p(exp) is what I was 
> asking for in one of my recent posts here. It seems I was "right" again.
>
>
> The article also shows some of the function attributes, in truth in GCC there 
> are many other of such attributes. Some of them are useful for D too.
>
> The good thing of adding some of those things to D is that they can be put in 
> the specs, so they don't become nonstandard extensions as in GCC, this avoids 
> several troubles.

I think it's kind of silly that you constantly whine to Walter
whenever he adds new features saying "why don't we fix the problems
that already exist in D like the module system," and then turn around
suggesting we add a bunch of features.

Which do you want? Do you want new features, or do you want things to be fixed?

Reply via email to