svn commit: samba r18030 - in branches/SAMBA_3_0/source/tdb/common: .
Author: vlendec Date: 2006-09-04 10:12:04 + (Mon, 04 Sep 2006) New Revision: 18030 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18030 Log: When compiling with C++, nested structs lead to nested class definitions which are not compatible. I am aware that this would be a huge change in Samba4, but I would like to see it in the code that is shared. Stefan, when you do merge work, can you get this across to Samba4? Thanks, Volker Modified: branches/SAMBA_3_0/source/tdb/common/transaction.c Changeset: Modified: branches/SAMBA_3_0/source/tdb/common/transaction.c === --- branches/SAMBA_3_0/source/tdb/common/transaction.c 2006-09-04 09:51:47 UTC (rev 18029) +++ branches/SAMBA_3_0/source/tdb/common/transaction.c 2006-09-04 10:12:04 UTC (rev 18030) @@ -88,6 +88,12 @@ */ +struct tdb_transaction_el { + struct tdb_transaction_el *next, *prev; + tdb_off_t offset; + tdb_len_t length; + unsigned char *data; +}; /* hold the context of any current transaction @@ -105,12 +111,7 @@ ordered, with first element at the front of the list. It needs to be doubly linked as the read/write traversals need to be backwards, while the commit needs to be forwards */ - struct tdb_transaction_el { - struct tdb_transaction_el *next, *prev; - tdb_off_t offset; - tdb_len_t length; - unsigned char *data; - } *elements, *elements_last; + struct tdb_transaction_el *elements, *elements_last; /* non-zero when an internal transaction error has occurred. All write operations will then fail until the
Re: svn commit: samba r18030 - in branches/SAMBA_3_0/source/tdb/common: .
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [EMAIL PROTECTED] schrieb: Author: vlendec Date: 2006-09-04 10:12:04 + (Mon, 04 Sep 2006) New Revision: 18030 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18030 Log: When compiling with C++, nested structs lead to nested class definitions which are not compatible. I am aware that this would be a huge change in Samba4, but I would like to see it in the code that is shared. Hi Volker, Does this also apply to unnamed substructures? like this: struct foo { int bla; struct { int val1; int val1; } vals; }; and what's with unions with unnamed substructs? like this: union foo { struct { struct { int val1; } in; struct { int val2; } out; } level1; }; metze -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iD8DBQFE+/30m70gjA5TCD8RAjXzAJ9m/wOTXDvDp726ScPn2fKNaP0Q/wCeNBNh 1iuMAbLtGaq9Y7AdNb2k9RE= =V1I+ -END PGP SIGNATURE-
Re: svn commit: samba r18030 - in branches/SAMBA_3_0/source/tdb/common: .
Volker, When compiling with C++, nested structs lead to nested class definitions which are not compatible. I am aware that this would be a huge change in Samba4, but I would like to see it in the code that is shared. this may be a step too far. C and C++ are different languages, and while it is useful to be able to get warnings from g++ is nice, I don't think it should lead us to worse coding practices. Nesting structure definitions keeps structure definitions cleaner, and keeps related structures closer together. Do you actually have plans to use real C++ somewhere with the Samba code, or is this purely for the warnings? Perhaps it might gain more to put some effort into adapting sparse for warnings that are applicable to Samba code? It is a much more powerful static analyser than g++ ever will be, and doesn't require a change of language :-) Cheers, Tridge
Nested structures in C [was Re: svn commit: samba r18030 - in branches/SAMBA_3_0/source/tdb/common]
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [EMAIL PROTECTED] wrote: Author: vlendec Date: 2006-09-04 10:12:04 + (Mon, 04 Sep 2006) New Revision: 18030 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18030 Log: When compiling with C++, nested structs lead to nested class definitions which are not compatible. I am aware that this would be a huge change in Samba4, but I would like to see it in the code that is shared. Stefan, when you do merge work, can you get this across to Samba4? Hey Volker, I've got to agree with tridge here. These kind of things are just not going to go away. The entire autogenerated code from pidl uses the nested structure convention. And we're about to get a lot more of that in Samba 3. cheers, jerry = Samba--- http://www.samba.org Centeris --- http://www.centeris.com What man is a man who does not make the world better? --Balian -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.4 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFE/Ma4IR7qMdg1EfYRAudaAJ9u0KBvlzzG+qklV2N7QDxytuQXBgCfYg/j A3D4hkVYIEPwZ25cbObeozA= =Z4wf -END PGP SIGNATURE-
Re: Nested structures in C [was Re: svn commit: samba r18030 - in branches/SAMBA_3_0/source/tdb/common]
On Mon, Sep 04, 2006 at 07:37:12PM -0500, Gerald (Jerry) Carter wrote: I've got to agree with tridge here. These kind of things are just not going to go away. The entire autogenerated code from pidl uses the nested structure convention. And we're about to get a lot more of that in Samba 3. You C++-hating luddite :-) :-). I can see I've lost this one...