Suggestion for C++ language extensions

Discussion in 'C++' started by Ekkehard Morgenstern, Nov 14, 2003.

  1. Hi all,

    I'd like to suggest the following features for future standards of the C++
    programming language. I have not read the more recent standard documents, so
    I'm not sure whether some are already in the standard, so tell me if so.

    1. The addition of the BCPL valof (value of) expression syntax.
    valof-expr := 'valof' type '{' statement-block '}' .
    It would be notated like " int c = valof int { return 3+5; } "
    2. The addition of at least standard headers, if not new types, for
    bit-size-specific types, like "uint32_t".
    3. The addition of optional range checking for standard array types.
    array-dim-def := '[' expr [ 'range' [ expr '..' expr ]
    'checked' ] ']' .
    this could look like "int a[3 range checked 0..2]" or "int a[3
    range checked]" for example.
    4. The addition of dynamic arrays.
    array-dim-def := '[' expr | 'dynamic' ']'
    this could look like "int a[dynamic];"
    5. The addition of optionally checked pointer types.
    pointer-def := 'checked' type '*'; // or similar
    this could look like "checked int* p;"
    a pointer like this would be checked during runtime before usage
    (like, at the first use in every block scope or something, or during every
    operation).
    6. The addition of value range checking for integral or floating-point base
    types.
    range-checked-base-type := [ 'range' [ expr '..' expr ]
    'checked' ] base-type .
    This could look like "range 0..2 checked int a;"
    A check would be performed before every assignment to such a
    variable.
    A default range-checked variable, like "range checked int a;"
    would be checked for overflows in arithmetic operations also.
    7. The addition of an optional byte ordering syntax for integral or
    floating-point base types.
    ordered-base-type := [ ( 'msblsb' | 'lsbmsb' ) 'ordered' ]
    base-type .
    This would look like 'msblsb ordered int a = 0x12345678;'.
    This would permit setting the byte ordering for structure
    members, for example. The compiler would generate code to read and write
    such variables properly, for example.
    This way, reading and writing such fields from and to permanent
    storage or streams would be a piece of cake without any programming
    overhead.
    8. The definition of anonymous classes.
    class-decl := ( 'anonymous' 'class' | 'class' identifier )
    class-decl-body .
    this would look like "A* a = new anonymous class : public A {
    .... }"
    Constructors and destructors could use "anonymous()" then.

    (I'll implement these features in my new Q2 (working title) programming
    language, but it'd be great to find them in C++ as well.)

    Regards,
    Ekkehard Morgenstern.
    Ekkehard Morgenstern, Nov 14, 2003
    #1
    1. Advertising

  2. "Ekkehard Morgenstern" <> wrote...
    > I'd like to suggest the following features for future standards of the C++
    > programming language. [...]


    Wrong newsgroup. Try comp.std.c++.
    Victor Bazarov, Nov 14, 2003
    #2
    1. Advertising

  3. Hi Victor Bazarov,

    "Victor Bazarov" <> schrieb im Newsbeitrag
    news:Zkctb.148496$mZ5.1009847@attbi_s54...
    > Wrong newsgroup. Try comp.std.c++.


    Thanks! :)

    Regards,
    Ekkehard Morgenstern.
    Ekkehard Morgenstern, Nov 14, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ed
    Replies:
    24
    Views:
    1,001
    Dimitri Maziuk
    Mar 27, 2006
  2. Diego Martins
    Replies:
    10
    Views:
    2,176
    peter koch
    Nov 27, 2006
  3. jacob navia
    Replies:
    43
    Views:
    977
  4. Ted Zlatanov
    Replies:
    20
    Views:
    206
    Martijn Lievaart
    Jul 16, 2007
  5. Christos Kokaliaris
    Replies:
    45
    Views:
    301
    Jorgen Grahn
    Jun 16, 2014
Loading...

Share This Page