[Xcb] no more *_new functions

Jamey Sharp jamey at minilop.net
Tue Oct 10 13:06:42 PDT 2006


On Tue, Oct 10, 2006 at 03:09:55PM -0400, Jeremy A. Kolb wrote:
> On Tue, 10 Oct 2006, Jamey Sharp wrote:
> > On Tue, Oct 10, 2006 at 08:26:07PM +0200, Vincent Torri wrote:
> > > Hey,
> > 
> > Hi, Vincent!
> 
> Hi Jamey!

Hi Jeremy!

> > Yes, the _new functions are no longer useful since XID types are just
> > typedef'd integers now. Instead, just call xcb_generate_id, which has
> > been moved to xcb.h.
> 
> I kind of liked seeing the type names in there.  It's less error prone and 
> I think the user would be less likely to use an xid w/o initializing 
> it first.

Those are interesting arguments, but I don't quite understand them.

How is it less error-prone to call xcb_window_new rather than
xcb_generate_id? The former just calls the latter, and their type
signatures are identical. Since we no longer have compile-time type
checking here, I'd think it would be confusing that you can call
xcb_window_new and pass the result to xcb_open_font, even though doing
so would produce no errors at run-time.

Why is xcb_generate_id less likely to induce programmers to initialize
their variables than xcb_window_new? A decent compiler will catch such
errors anyway...

--Jamey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/xcb/attachments/20061010/91dc5571/attachment.pgp


More information about the Xcb mailing list