Re: main function address

From: Leor Zolman (leor_at_bdsoft.com)
Date: 04/07/04


Date: Wed, 07 Apr 2004 12:58:56 GMT

On Wed, 07 Apr 2004 07:47:04 -0400, Lew Pitcher <Lew.Pitcher@td.com> wrote:
.
>
>In 9989-1999 (admittedly, just the draft C99 standard, and not the
>/actual standard itself), the printf() function documentation in
>7.19.6.3 refers the reader to the fprintf() documentation for a
>description of it's input. The fprintf() documentation in 7.19.6.1 says
>of the %p format
>
>~ p The argument shall be a pointer to void. The value of the pointer is
>~ converted to a sequence of printing characters, in an
>~ implementation-defined manner.
>
>So, to satisfy the %p format character, the argument to
>fprintf()/printf() /must/ be a "pointer to void". Since main is a
>"pointer to function returning int", and not a "pointer to void", I
>interpreted the documentation as requiring a cast to void pointer.

Curious -- I've never considered how implicit conversion rules ought to
play out in the arena of variadic functions... on one hand, pointers to
/anything/ implicitly convert to pointer-to-void, but on the other hand
there's no declaration for the receiving pointer-to-void.

Or, does the implicit conversion apply when the pointer value is extracted
and cast to void * in the receiving function?
        -leor

-- 
Leor Zolman --- BD Software --- www.bdsoft.com
On-Site Training in C/C++, Java, Perl and Unix  
C++ users: Download BD Software's free STL Error Message Decryptor at:
   www.bdsoft.com/tools/stlfilt.html


Relevant Pages

  • Re: Documentation on implementing a Windows Scripting Engine
    ... that documentation certainly qualifies as private. ... can get access to it if you start working for Microsoft. ... Otherswise a scripting engine is simply a language interpreter. ... Does anyone have a pointer as to a good source of documentation on this ...
    (microsoft.public.win32.programmer.ole)
  • Correct way of changing MFC application name (m_pszAppName)
    ... the MSDN documentation regarding how to change ... the module state struct holds a copy of the m_pszAppName pointer. ... AfxGetAppName() function returns AfxGetModuleState->m_lpszCurrentAppName. ...
    (microsoft.public.vc.mfc)
  • Re: Receiving single bytes with MSComm
    ... Lacking any documentation on MSCOMM (as I pointed out, if it was important and useful it ... You are doing a V_BSTR cast, which I believe is casting to a pointer to a Unicode string, ... If it were an important control, ...
    (microsoft.public.vc.mfc)
  • Re: main function address
    ... The fprintf() documentation in 7.19.6.1 says ... The value of the pointer is ... >> interpreted the documentation as requiring a cast to void pointer. ...
    (comp.lang.c)
  • Re: by ref parameter is just a syntax sugar?
    ... it exhibits a little uncertainty. ... How can a pointer be true or false? ... Because of it's implicit conversion. ... explains one of the reasons why I dislike such code. ...
    (alt.comp.lang.learn.c-cpp)