On Mon, Jun 27, 2011 at 5:45 PM, Mike Frysinger <[email protected]> wrote:
> On Friday, June 24, 2011 10:39:29 Jie Zhang wrote:
>> On Fri, Jun 17, 2011 at 4:39 PM, Mike Frysinger wrote:
>> > On Friday, June 17, 2011 16:09:47 Jie Zhang wrote:
>> >> On Fri, Jun 17, 2011 at 1:58 PM, Mike Frysinger wrote:
>> >> >> +    const char *ex_short = "[firmware=FILE]";
>> >> >> +    const char *ex_desc = "FILE       Upgrade the ICE firmware.  See
>> >> >> this
>> >> >
>> >> > page:\n"
>> >> >
>> >> > const char foo[] = "..."
>> >>
>> >> Why?
>> >
>> > one less pointer.  compare the assembly output:
>> > $ echo 'const char foo[] = "asdf";' | gcc -S -o - -x c -
>> > $ echo 'const char *foo = "asdf";' | gcc -S -o - -x c -
>>
>> But when it's passed as an argument, the former will pass the whole
>> string but the latter will only pass a pointer.
>
> no it wont.  in both cases, passing it as an argument will pass a pointer.
>
On x86_64-linux-gnu host with -O2, the former:

ice_cable_help:
.LFB70:
        .cfi_startproc
        subq    $152, %rsp
        .cfi_def_cfa_offset 160
        movabsq $8242000105019369051, %rcx
        movabsq $26253366783262053, %rdx
        movq    %rcx, 128(%rsp)
        movq    %rdx, 136(%rsp)
        movl    %edi, %eax
        movq    %rsi, %r8
        movq    %rsp, %rdi
        movl    $.LC3, %esi
        movl    $15, %ecx
        rep movsq
        movq    %rsp, %rcx
        movl    (%rsi), %edx
        movq    %r8, %rsi
        movl    %edx, (%rdi)
        movzwl  .LC3+124(%rip), %edx
        movw    %dx, 4(%rdi)
        leaq    128(%rsp), %rdx
        movl    %eax, %edi
        call    urj_tap_cable_generic_usbconn_help_ex
        addq    $152, %rsp
        ret
        .cfi_endproc
.LFE70:
        .size   ice_cable_help, .-ice_cable_help

The latter:

ice_cable_help:
.LFB70:
        .cfi_startproc
        movl    $.LC3, %ecx
        movl    $.LC4, %edx
        jmp     urj_tap_cable_generic_usbconn_help_ex
        .cfi_endproc
.LFE70:
        .size   ice_cable_help, .-ice_cable_help



Jie

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
UrJTAG-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/urjtag-development

Reply via email to