Skip to content
Snippets Groups Projects
  • Peter Eisentraut's avatar
    4cb82469
    Cast result of copyObject() to correct type · 4cb82469
    Peter Eisentraut authored
    
    copyObject() is declared to return void *, which allows easily assigning
    the result independent of the input, but it loses all type checking.
    
    If the compiler supports typeof or something similar, cast the result to
    the input type.  This creates a greater amount of type safety.  In some
    cases, where the result is assigned to a generic type such as Node * or
    Expr *, new casts are now necessary, but in general casts are now
    unnecessary in the normal case and indicate that something unusual is
    happening.
    
    Reviewed-by: default avatarMark Dilger <hornschnorter@gmail.com>
    4cb82469
    History
    Cast result of copyObject() to correct type
    Peter Eisentraut authored
    
    copyObject() is declared to return void *, which allows easily assigning
    the result independent of the input, but it loses all type checking.
    
    If the compiler supports typeof or something similar, cast the result to
    the input type.  This creates a greater amount of type safety.  In some
    cases, where the result is assigned to a generic type such as Node * or
    Expr *, new casts are now necessary, but in general casts are now
    unnecessary in the normal case and indicate that something unusual is
    happening.
    
    Reviewed-by: default avatarMark Dilger <hornschnorter@gmail.com>