
12 Jun
2012
12 Jun
'12
9:10 p.m.
Hi Johan, On Tue, Jun 12, 2012 at 04:57:00PM -0700, Johan Tibell wrote:
getFullProgName which does the sensible thing of returning argv[0]. Here's an implementation:
getFullProgName :: IO String getFullProgName = alloca $ \ p_argc -> alloca $ \ p_argv -> do getFullProgArgv p_argc p_argv peek p_argv >>= peek >>= peekCString
Are those 3 peeks all guaranteed to not be of NULL pointers on all platforms and in all situations? If not, wouldn't it be better to check for NULL and throw an exception? Thanks Ian