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

Re: [PATCH 1/2] help: add help_unknown_ref

From
Johannes Sixt <j6t@kdbg.org>
Date
May 1, 2013, 20:23 UTC
Message-ID
<518179DD.8050009@kdbg.org>
In-Reply-To
<51817319.6060201@gmail.com>
Am 01.05.2013 21:55, schrieb Vikrant Varma:
Show 17 quoted lines
> On 01-05-2013 17:53, Ramkumar Ramachandra wrote:
>> Vikrant Varma wrote:
>>> +void help_unknown_ref(const char* ref) {
>>> +        int i;
>>> +        struct similar_ref_cb ref_cb;
>>> +        ref_cb.similar_refs = (struct string_list)STRING_LIST_INIT_NODUP;
>>
>> Why are you casting STRING_LIST_INIT_NODUP?
>>
>>> +        ref_cb.base_ref = ref;
> 
> 
> ref_cb.similar_refs has already been defined. The compiler won't let me
> assign to it unless I cast first. However, I think compound literals are
> a C99/gcc feature. Is this better?
> 
>     struct similar_ref_cb ref_cb = {ref, STRING_LIST_INIT_NODUP};

No. There are compilers that can initialize a struct only with constant data, but ref is not a constant.

-- Hannes
Previous: Vikrant VarmaNext: Ramkumar Ramachandra
Message 6 of 16 in “Better advice on merge”
  1. 0/2 Better advice on mergeVikrant Varma, May 1, 2013
  2. 1/2 help: add help_unknown_refVikrant Varma, May 1, 2013
  3. Ramkumar RamachandraMay 1, 2013
  4. Matthieu MoyMay 1, 2013
  5. Vikrant VarmaMay 1, 2013
  6. Johannes SixtMay 1, 2013
  7. Ramkumar RamachandraMay 1, 2013
  8. Vikrant VarmaMay 1, 2013
  9. Junio C HamanoMay 1, 2013
  10. Junio C HamanoMay 1, 2013
  11. Vikrant VarmaMay 1, 2013
  12. Junio C HamanoMay 1, 2013
  13. 2/2 merge: use help_unknown_ref instead of dieVikrant Varma, May 1, 2013
  14. Junio C HamanoMay 1, 2013
  15. Jonathan NiederMay 1, 2013
  16. Vikrant VarmaMay 1, 2013

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.