forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

const declarations

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Sat Sep 17, 2005 4:45 pm    Post subject: const declarations Reply with quote

Some sce*-functions don't change the data, which are passed as pointers, like

int sceKernelUtilsMd5Digest(u8 *data, u32 size, u8 *digest);

so it should be

int sceKernelUtilsMd5Digest(const u8 *data, u32 size, u8 *digest);

The reason is that when I'm using 3'rd party libraries, sometimes the return values are const, which is fine, but then I have to cast it for the sce*-functions, which is not necessary. I don't think that the changes breaks code, but it makes new code more safe and readable.
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Sun Sep 18, 2005 12:17 am    Post subject: Reply with quote

And what's up with "u8 *"? It should be "void *". This isn't the K&R days :).
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Mon Sep 19, 2005 5:45 am    Post subject: Reply with quote

mrbrown wrote:
And what's up with "u8 *"? It should be "void *". This isn't the K&R days :).


Yes, this would be fine, too.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group