VA_LIST on 64-bit

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • saurabhchokshi
    New Member
    • Feb 2008
    • 4

    #1

    VA_LIST on 64-bit

    Hello all,

    I am using vfprintf in my application. I am using va_list as a char * and then typecast it with va_list data type.

    This thing works on 32-Bit platform. However, it doesn't work on 64-Bit platform.

    Do va_start, va_copy and va_stop will solve this issue?

    For Example, This is the existing code on 32-bit

    char t[5];
    char *p_t;

    p_t = t;

    while(){
    vfprintf(fd, p_format , p_t + sizeof(void *))
    }

    However, I want to execute the same code with va_start, va_copy and va_end between vfprintf. Will this work?

    I have tried but didn't get it through. Could you please help me out to resolve this issue?

    Thanks,
    Saurabh
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    If you use the proper macros then it should work. The problem with what you have done is because the the difference in pointer size between 32 and 64 systems.

    Comment

    • saurabhchokshi
      New Member
      • Feb 2008
      • 4

      #3
      What kind of macro I should use to run this code? Do I need to use va_start, va_copy and va_end macros?

      The same code executes on 32 bit platform. I have noticed one more thing on 64-bit platform, size of va_list = 24 bytes on 64 bit and 4 bytes on 32 bit.

      Any clue how to use the vfprintf in this scenario?

      Comment

      Working...