Changeset 14f6bb39 for src


Ignore:
Timestamp:
Feb 28, 2017, 3:20:59 PM (8 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
1e6b350, f37147b
Parents:
fd061ed3
Message:

Add missing overloads of comparison operators on pointers

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/prelude/prelude.cf

    rfd061ed3 r14f6bb39  
    131131                !?( float _Complex ),           !?( double _Complex ),          !?( long double _Complex );
    132132
     133forall ( dtype DT ) int !?(                DT * );
     134forall ( dtype DT ) int !?( const          DT * );
     135forall ( dtype DT ) int !?(       volatile DT * );
    133136forall ( dtype DT ) int !?( const volatile DT * );
    134137forall ( ftype FT ) int !?( FT * );
     
    235238           ?>?( long double, long double ),                             ?>=?( long double, long double );
    236239
     240forall( dtype DT ) signed int ?<?(                 DT *,                DT * );
     241forall( dtype DT ) signed int ?<?(  const          DT *, const          DT * );
     242forall( dtype DT ) signed int ?<?(        volatile DT *,       volatile DT * );
    237243forall( dtype DT ) signed int ?<?(  const volatile DT *, const volatile DT * );
     244
     245forall( dtype DT ) signed int ?>?(                 DT *,                DT * );
     246forall( dtype DT ) signed int ?>?(  const          DT *, const          DT * );
     247forall( dtype DT ) signed int ?>?(        volatile DT *,       volatile DT * );
    238248forall( dtype DT ) signed int ?>?(  const volatile DT *, const volatile DT * );
     249
     250forall( dtype DT ) signed int ?<=?(                 DT *,                DT * );
     251forall( dtype DT ) signed int ?<=?(  const          DT *, const          DT * );
     252forall( dtype DT ) signed int ?<=?(        volatile DT *,       volatile DT * );
    239253forall( dtype DT ) signed int ?<=?( const volatile DT *, const volatile DT * );
     254
     255forall( dtype DT ) signed int ?>=?(                 DT *,                DT * );
     256forall( dtype DT ) signed int ?>=?(  const          DT *, const          DT * );
     257forall( dtype DT ) signed int ?>=?(        volatile DT *,       volatile DT * );
    240258forall( dtype DT ) signed int ?>=?( const volatile DT *, const volatile DT * );
    241259
  • src/tests/avltree/avl_test.c

    rfd061ed3 r14f6bb39  
    3636
    3737  // char* -> char*
    38   int ?<?(char *a, char *b) {
    39     return strcmp(a,b) < 0;
     38  struct c_str { char *str; };  // wraps a C string
     39  int ?<?(c_str a, c_str b) {
     40    return strcmp(a.str,b.str) < 0;
    4041  }
    41   tree(char *, char *) * ssmap = create("queso", "cheese");
    42   insert(&ssmap, "foo", "bar");
    43   insert(&ssmap, "hello", "world");
     42  tree(c_str, char *) * ssmap = create((c_str){"queso"}, "cheese");
     43  insert(&ssmap, (c_str){"foo"}, "bar");
     44  insert(&ssmap, (c_str){"hello"}, "world");
    4445  assert( height(ssmap) == 2 );
    4546
    46   printf("%s %s %s\n", *find(ssmap, "hello"), *find(ssmap, "foo"), *find(ssmap, "queso"));
     47  printf("%s %s %s\n", *find(ssmap, (c_str){"hello"}), *find(ssmap, (c_str){"foo"}), *find(ssmap, (c_str){"queso"}));
    4748
    48   remove(&ssmap, "foo");
     49  remove(&ssmap, (c_str){"foo"});
    4950  delete(ssmap);
    5051}
Note: See TracChangeset for help on using the changeset viewer.