{"thread":{"id":"43548","subject":"Re: [PATCH 1/3] Apply obvious numerical cast for stupid C compilers.","startedAt":"2006-11-05T05:35:44Z","lastAt":"2006-11-05T07:06:52Z","messageCount":2,"participants":["Junio C Hamano","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"297545","messageId":"20061105053544.GA4193@spearce.org","threadId":"43548","inReplyTo":null,"subject":"[PATCH 1/3] Apply obvious numerical cast for stupid C compilers.","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-11-05T05:35:44Z","receivedAt":"2006-11-05T05:35:44Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"At least one (older) version of the Solaris C compiler won't allow\n'unsigned long x = -1' without explicitly casting -1 to a type of\nunsigned long.  As annoying as it may be to explicitly perform the\ncast the compiler is right; -1 is not an unsigned value.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n builtin-apply.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-apply.c b/builtin-apply.c\nindex db7cdce..d7b3cea 100644\n--- a/builtin-apply.c\n+++ b/builtin-apply.c\n@@ -43,7 +43,7 @@ static int apply_verbosely;\n static int no_add;\n static int show_index_info;\n static int line_termination = '\\n';\n-static unsigned long p_context = -1;\n+static unsigned long p_context = (unsigned long)-1;\n static const char apply_usage[] =\n \"git-apply [--stat] [--numstat] [--summary] [--check] [--index] [--cached] [--apply] [--no-add] [--index-info] [--allow-binary-replacement] [--reverse] [--reject] [--verbose] [-z] [-pNUM] [-CNUM] [--whitespace=<nowarn|warn|error|error-all|strip>] <patch>...\";\n \n-- \n1.4.3.3.g9621\n"},{"id":"295415","messageId":"7v3b8ywewj.fsf@assigned-by-dhcp.cox.net","threadId":"43548","inReplyTo":"20061105053544.GA4193@spearce.org","subject":"Re: [PATCH 1/3] Apply obvious numerical cast for stupid C compilers.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-11-05T07:06:52Z","receivedAt":"2006-11-05T07:06:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> writes:\n\n> At least one (older) version of the Solaris C compiler won't allow\n> 'unsigned long x = -1' without explicitly casting -1 to a type of\n> unsigned long.  As annoying as it may be to explicitly perform the\n> cast the compiler is right; -1 is not an unsigned value.\n\nIs the compiler really _right_?  The usual integral promotion\nrules should apply if it claims to be a C compiler, I would\nthink.\n\nBut I think the code actually wants ULONG_MAX there.  Is that\nsymbolic constant available at the point of offending\ninitialization with the header files we already include, I\nwonder.\n\nIn other words, how about this patch instead?\n\n-- >8 --\n\ndiff --git a/builtin-apply.c b/builtin-apply.c\nindex db7cdce..aad5526 100644\n--- a/builtin-apply.c\n+++ b/builtin-apply.c\n@@ -43,7 +43,7 @@ static int apply_verbosely;\n static int no_add;\n static int show_index_info;\n static int line_termination = '\\n';\n-static unsigned long p_context = -1;\n+static unsigned long p_context = ULONG_MAX;\n static const char apply_usage[] =\n \"git-apply [--stat] [--numstat] [--summary] [--check] [--index] [--cached] [--apply] [--no-add] [--index-info] [--allow-binary-replacement] [--reverse] [--reject] [--verbose] [-z] [-pNUM] [-CNUM] [--whitespace=<nowarn|warn|error|error-all|strip>] <patch>...\";\n \n"}]}