Why use (void) func() ?

Jens Tingleff jensting at skinfaxe.diku.dk
Tue Sep 25 05:30:12 AEST 1990


dave at dptechno.uucp (Dave Lee) writes:

[..]

>To both 1 and 2 I reply: 

>If I wanted to check the return value, I would have.
>This is not the sort of thing that results from a typo or unconcious omission.
>I never type

GOTCHA! Try these two

int function_with_some_side_effects();

other func()
{
	int a,b;

	b = function_with_side_effects(some_global);
	a = b + function_with_side_effects(some_global);
}

---OR---
{
	int a,b;
	b = function_with_side_effects(some_global);
	a = b ; function_with_side_effects(some_global);
}
	      ^
	      +-- Grade A typo, if you keyboard has '+' as SHIFT ';'
		  (such as this keyboard, a TVI955)

Enough said.. .

	Jens
Jens Tingleff MSc EE, Institute of Computer Science, Copenhagen University
Snail mail: DIKU Universitetsparken 1, DK2100 KBH O
"It never runs around here; it just comes crashing down"
	apologies to  Dire Straits 



More information about the Comp.lang.c mailing list