From: Diego 'F. <fla...@ge...> - 2006-09-10 01:53:15
|
So, tonight I suffered from a few debugging problems while trying to implem= ent=20 the mmapped file support (it's comfortable when you try 6 files, it works,= =20 you try the 7th, it fails, eh? :) ). Luckily now it's all fixed, but during= =20 the debug session, I've started wondering something. Most of the plugin functions in xine are declared this way: static off_t file_plugin_read (input_plugin_t *this_gen, char *buf, off_t l= en)=20 { file_input_plugin_t *this =3D (file_input_plugin_t *) this_gen; Unfortunately this is difficult to debug in gdb, because the minimum=20 optimisation you add, this will be removed out of debugger's view. I suppose this declaration is to force the first parameter to conform so th= at=20 when using the function's pointer it doesn't collide with the declaration o= f=20 the function. This is all well and good, but I'm not sure if it's worth the= =20 hassle of the lost debugging. Declaring the one above as static off_t file_plugin_read (file_input_plugin_t *this, char *buf, off_t= =20 len) { makes sure that the symbol "this" is almost always visible on the debugger,= =20 and only spawns an extra warning that can be easily made silent, by casting= =20 the function when passing the function's parameter to the struct. Is there anything else for which the first notation is needed in xine? =2D-=20 Diego "Flameeyes" Petten=F2 - http://farragut.flameeyes.is-a-geek.org/ Gentoo/Alt lead, Gentoo/FreeBSD, Video, AMD64, Sound, PAM, KDE |