git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v4] gc: call "prune --expire 2.weeks.ago" by default

From
Wincent Colaiuta <win@wincent.com>
Date
Mar 13, 2008, 09:48 UTC
Message-ID
<7FB80115-C1E4-4F83-9374-41AB1BDA0579@wincent.com>
In-Reply-To
<7vod9j342h.fsf@gitster.siamese.dyndns.org>
El 13/3/2008, a las 0:39, Junio C Hamano escribió:
Show 15 quoted lines
> Ah,...
>
> But C language rules haven't changed in such a way that it  
> guarantees B to
> be evaluated before A when you write "A >= B", have it?
>
> So at least I think you would need something like this if you go that
> route:
>
>  		if (strcmp(value, "now")) {
>                	unsigned long now = approxidate("now");
>                	if (approxidate(value) >= now)
> 				return error("Invalid %s: '%s'", var, value);
> 			...
> 		}

Are you sure that that alternative provides any guarantees about evaluation order either? (I'm not a compiler expert, nor am I consulting a copy of the standard; but I don't think it does.)

In order to enforce evaluation in the required order I think it might have to be something like this:

	if (strcmp(value, "now")) {
		unsigned long now;
		if ((now = approxidate("now")) &&
		    approxidate(value) >= now)
			return error("Invalid %s: '%s'", var, value);
		...
	}

ie. the && operator guarantees left to right evaluation order, and since approxidate always returns a non-zero ulong the second expression (after the &&) will always be evaluated.

Cheers, Wincent

Previous: Johannes SchindelinNext: Johannes Sixt
Message 38 of 41 in “gc: call "prune --expire 2.weeks.ago"”
  1. gc: call "prune --expire 2.weeks.ago"Johannes Schindelin, Mar 11, 2008
  2. Junio C HamanoMar 12, 2008
  3. Nicolas PitreMar 12, 2008
  4. Junio C HamanoMar 12, 2008
  5. Johannes SchindelinMar 12, 2008
  6. Nicolas PitreMar 12, 2008
  7. Pieter de BieMar 12, 2008
  8. Johannes SchindelinMar 12, 2008
  9. Jeff KingMar 12, 2008
  10. Pieter de BieMar 12, 2008
  11. Junio C HamanoMar 12, 2008
  12. Johannes SchindelinMar 12, 2008
  13. Junio C HamanoMar 12, 2008
  14. Geert BoschMar 12, 2008
  15. Nicolas PitreMar 12, 2008
  16. Marko KreenMar 12, 2008
  17. gc: call "prune --expire 2.weeks.ago" by defaultJohannes Schindelin, Mar 12, 2008
  18. Brandon CaseyMar 12, 2008
  19. Jakub NarebskiMar 12, 2008
  20. Johannes SchindelinMar 12, 2008
  21. Junio C HamanoMar 12, 2008
  22. Johannes SchindelinMar 12, 2008
  23. gc: call "prune --expire 2.weeks.ago" by defaultJohannes Schindelin, Mar 12, 2008
  24. Johannes SchindelinMar 12, 2008
  25. Brandon CaseyMar 12, 2008
  26. Johannes SchindelinMar 12, 2008
  27. Brandon CaseyMar 12, 2008
  28. Junio C HamanoMar 12, 2008
  29. gc: call "prune --expire 2.weeks.ago" by defaultJohannes Schindelin, Mar 12, 2008
  30. Johannes SchindelinMar 12, 2008
  31. Junio C HamanoMar 12, 2008
  32. Nicolas PitreMar 12, 2008
  33. Johannes SchindelinMar 12, 2008
  34. Junio C HamanoMar 12, 2008
  35. Johannes SchindelinMar 12, 2008
  36. Junio C HamanoMar 12, 2008
  37. Johannes SchindelinMar 12, 2008
  38. Wincent ColaiutaMar 13, 2008
  39. Johannes SixtMar 13, 2008
  40. Wincent ColaiutaMar 13, 2008
  41. Johannes SchindelinMar 13, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.