Proposal: Add getFullProgName

Ian Lynagh igloo at earth.li
Wed Jun 13 03:10:20 CEST 2012


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




More information about the Libraries mailing list