[Alephmodular-devel] Grrf on types in preferences.cpp
Status: Pre-Alpha
                
                Brought to you by:
                
                    brefin
                    
                
            | 
      
      
      From: Br'fin <br...@ma...> - 2002-12-16 17:13:40
      
     | 
| trying to cleanup the conversion warnings in preferences.cpp and found  
this most annoying case:
...
	/* If we didn't open, we initialized.. */
	graphics_preferences= get_graphics_pref_data();
	player_preferences= get_player_pref_data();
	input_preferences= get_input_pref_data();
	sound_preferences= get_sound_pref_data();
	serial_preferences= w_get_data_from_preferences(prefSERIAL_TAG,
		sizeof(struct serial_number_data), default_serial_number_preferences,
		validate_serial_number_preferences);
	network_preferences= w_get_data_from_preferences(prefNETWORK_TAG,
		sizeof(struct network_preferences_data), default_network_preferences,
		validate_network_preferences);
	environment_preferences= get_environment_pref_data();
}
struct preferences_dialog_data prefs_data[]={
	{ strPREFERENCES_GROUPS, graphicsGroup, ditlGRAPHICS,  
get_graphics_pref_data, setup_graphics_dialog, hit_graphics_item,  
teardown_graphics_dialog },
	{ strPREFERENCES_GROUPS, playerGroup, ditlPLAYER,  
get_player_pref_data, setup_player_dialog, hit_player_item,  
teardown_player_dialog },
	{ strPREFERENCES_GROUPS, soundGroup, ditlSOUND, get_sound_pref_data,  
setup_sound_dialog, hit_sound_item, teardown_sound_dialog },
	{ strPREFERENCES_GROUPS, inputGroup, ditlINPUT, get_input_pref_data,  
setup_input_dialog, hit_input_item, teardown_input_dialog },
#ifndef DEMO
	{ strPREFERENCES_GROUPS, environmentGroup, ditlENVIRONMENT,  
get_environment_pref_data, setup_environment_dialog,  
hit_environment_item, teardown_environment_dialog }
#endif
};
#define NUMBER_OF_PREFS_PANELS (sizeof(prefs_data)/sizeof(struct  
preferences_dialog_data))
...
The first batch of complains currently because get_*_pref_data returns  
a void* (And all the variables are typed pointers) And the second batch  
of code, the prefs_data is expecting argument functions of the form  
void*(*func)() (the functions as they currently are and as they return  
void pointers)
I could just put static_cast<appropriate*>(get_*_prefs_data()) in the  
first batch. It solves the warning problems, but certainly doesn't feel  
like the 'right' solution to this.
-Jeremy Parsons
--------------------- 
+------------------------------------------------------
Br'fin               |      TIMSter, MU*er, Web Programmer, ... Insane?
The Denim Warrior    |                  You be the judge...
br...@ma...       |
--------------------- 
+------------------------------------------------------
 |