[net.micro.amiga] V1.2 version checking....

bart@amiga.UUCP (Barry A. Whitebook) (09/04/86)

< eat this line - please! >

this is amiga!bart:

	recent code examples posted to this net have said something to this
	effect...

	" under V1.2 you can do this new thing... "

	followed by code which includes this type of example...

	/***************** start bad example fragment *************************/

	if ((FooBase = OpenLibrary("foo.library", 0)) == NULL)
	{
		my_go_away_and_die_routine("can't open ANY version of foo library");
	}
	else
	{
		do_1.2_thing();
		my_go_away_and_die_routine("did 1.2 thing");
	}

	/***************** stop  bad example fragment *************************/


	Q: Why is this a bad thing? 

	A: Example doesn't check to see whether it is running under v1.2 before
		doing its thing...


	/***************** start better example fragment *************************/

	#define V1_POINT_2	33

	if ((FooBase = OpenLibrary("foo.library", V1_POINT_2)) == NULL)
	{
		my_go_away_and_die_routine("can't open V1.2 version of foo library");
	}
	else
	{
		do_1.2_thing();
		my_go_away_and_die_routine("did 1.2 thing");
	}

	/***************** stop  better example fragment *************************/

	The bottom line: Please check that the poor user who accidentally tries
	to run your software which depends on 1.2 features under V1.1 or V1.0
	doesn't crash their machine.