Re: [Tracker] REVIEW: external-crawler branch, part4



On 08/08/14 09:54, Philip Van Hoof wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


c5d068279c9db7ac45e577b18b38d0bcb62b1d06

+       guint external_crawler : 1; /* TRUE if we're being feed files
+                                    * instead of discovering them
+                                    * ourselves */
+       guint mtime_checking : 1;   /* TRUE if mtime checks should be done
+                                    * during initial crawling. */
+       guint initial_crawling : 1; /* TRUE if initial crawling should be
+                                    * done */

What is this compiler and platform specific bitfield fscking all about?

That approach is used by a few of us on the team.

What is wrong with gboolean here? I know we are in a financial crisis
since 2008, but bits are not that expensive that we have to do crazy
about it.

It will mess up your alignment and padding and that makes future API
changes more difficult. You'll need to know how the bit fields will
happen on each architecture and compiler.

Well, yes and no. If your structure is created using GSLice, it handles memory alignment and colouring for you.

Regarding architecture, I agree, but we've had little complaints so far.

I think this is one of those "No you C developer. No. You should not
use bitfields in structs. You should use int like everybody else for
booleans (or gboolean in GLib)."

I won't discuss this much, I understand there are arguments for and against, you mention many above.

In the old code bitfields were also used for this. Equally wrong imho.

In general for code that is not in ie. the kernel: you should probably
not be using bitfields. Probably never.

I think that highly depends on the platform and product you're deploying.

For networking code it's just wrong because of padding/alignment (use
&, ~, << and >> instead to fiddle with bits).

And byte order presumably.

Still, as said, this is a bit of a non-issue.
Thanks Philip,

--
Regards,
Martyn

Founder & Director @ Lanedo GmbH.
http://www.linkedin.com/in/martynrussell


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]