Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!caip!cbmvax!amiga!bart From: bart@amiga.UUCP (Barry A. Whitebook) Newsgroups: net.micro.amiga Subject: V1.2 version checking.... Message-ID: <1504@amiga.amiga.UUCP> Date: Thu, 4-Sep-86 13:40:16 EDT Article-I.D.: amiga.1504 Posted: Thu Sep 4 13:40:16 1986 Date-Received: Fri, 5-Sep-86 06:45:24 EDT Reply-To: bart@cloyd.UUCP (Barry A. Whitebook) Organization: Commodore-Amiga Inc., 983 University Ave #D, Los Gatos CA 95030 Lines: 51 Keywords: 1.2 version checking < 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.