git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew DeVore <matvore@comcast.net>
To: Jeff King <peff@peff.net>, Matthew DeVore <matvore@google.com>
Cc: git@vger.kernel.org, gitster@pobox.com, pclouds@gmail.com,
	jonathantanmy@google.com, jeffhost@microsoft.com
Subject: Re: [PATCH] revisions.c: put promisor option in specialized struct
Date: Mon, 3 Dec 2018 14:01:12 -0800	[thread overview]
Message-ID: <0809e859-b3a6-79ef-031c-9ff3326da31d@comcast.net> (raw)
In-Reply-To: <20181203212431.GB8700@sigill.intra.peff.net>

On 12/03/2018 01:24 PM, Jeff King wrote:
>> @@ -297,7 +296,8 @@ struct setup_revision_opt {
>>   	const char *def;
>>   	void (*tweak)(struct rev_info *, struct setup_revision_opt *);
>>   	const char *submodule;	/* TODO: drop this and use rev_info->repo */
>> -	int assume_dashdash;
>> +	int assume_dashdash : 1;
>> +	int allow_exclude_promisor_objects : 1;
>>   	unsigned revarg_opt;
>>   };
> 
> I don't know that we need to penny-pinch bytes in this struct, but in
> general it shouldn't hurt either awy. However, a signed bit-field with 1
> bit is funny. I'm not even sure what the standard has to say, but in
> twos-complement that would store "-1" and "0" (gcc -Wpedantic also
> complains about overflow in assigning "1" to it).
Interesting. I hadn't suspected this. But I confirmed it with this:

#include <stdio.h>

struct x {
   int y : 1;
   int z : 1;
};

int main() {
   struct x x;
   x.y = 1;
   x.z = 1;
   printf("%d %d\n", (int) x.y, (int) x.z);
   return 0;
}

-- Output --
-1 -1

> 
> So this probably ought to be "unsigned".


Earlier in this file we define bit fields this way:
	/* Traversal flags */
	unsigned int	dense:1,
			prune:1,

... using \t to align the field names, so I'll mimic that style.

  reply	other threads:[~2018-12-03 22:09 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-23  1:13 [RFC 0/2] explicitly support or not support --exclude-promisor-objects Matthew DeVore
2018-10-23  1:13 ` [RFC 1/2] Documentation/git-log.txt: do not show --exclude-promisor-objects Matthew DeVore
2018-10-23  1:13 ` [RFC 2/2] exclude-promisor-objects: declare when option is allowed Matthew DeVore
2018-10-23  5:08   ` Junio C Hamano
2018-10-23 17:55     ` Matthew DeVore
2018-10-24  1:31       ` Junio C Hamano
2018-11-21 16:40   ` Jeff King
2018-12-01  1:32     ` Matthew DeVore
2018-12-01 19:44       ` Jeff King
2018-12-03 19:10         ` Matthew DeVore
2018-12-03 21:15           ` Jeff King
2018-12-03 21:54             ` Matthew DeVore
2018-12-04  2:20             ` Junio C Hamano
2018-12-03 19:23         ` [PATCH] revisions.c: put promisor option in specialized struct Matthew DeVore
2018-12-03 21:24           ` Jeff King
2018-12-03 22:01             ` Matthew DeVore [this message]
2018-10-23  1:18 ` [RFC 0/2] explicitly support or not support --exclude-promisor-objects Matthew DeVore
2018-10-23  4:48 ` Junio C Hamano
2018-10-23 17:09   ` Matthew DeVore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0809e859-b3a6-79ef-031c-9ff3326da31d@comcast.net \
    --to=matvore@comcast.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jeffhost@microsoft.com \
    --cc=jonathantanmy@google.com \
    --cc=matvore@google.com \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).