From Programming Language Pragmatics, by Scott:
If the programmer wishes to call a subroutine that does return a value, but the value is not needed in this particular case (all that matters is the side effect[s]), then the return value in C can be discarded by “casting” it to void:
foo_index = insert_in_symbol_table(foo); ... (void) insert_in_symbol_table(bar);
Can I just call such a subroutine which returns a value as if it returned void
?
insert_in_symbol_table(bar);
What syntax or semantics rules do I violate?
Thanks.