what's a "sentinel"?

This is a discussion on what's a "sentinel"? within the C Programming forums, part of the General Programming Boards category; As in warning: missing sentinel in function call...

  1. #1
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300

    what's a "sentinel"?

    As in warning: missing sentinel in function call
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    Post your example.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User slingerland3g's Avatar
    Join Date
    Jan 2008
    Location
    Seattle
    Posts
    602
    How have you declared your function. Also what is the line above that error? As that will note the function call your in.

    Please always paste code as well.

    If this is all you have then simply googling the error would produce better results for you.

  4. #4
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by slingerland3g View Post
    How have you declared your function. Also what is the line above that error? As that will note the function call your in.

    Please always paste code as well.

    If this is all you have then simply googling the error would produce better results for you.
    I didn't know the question was so complicated, or that the definition of "sentinel" would be contained in my code, but:

    Code:
    pid = fork();
    if (pid <0) {error_popup("fork() failed in \"tonote()\""); return;}
    edit: okay I googled it. "error_popup" doesn't involve a sentinel tho...this is a -Wall error...
    Last edited by MK27; 12-05-2008 at 10:39 AM.

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,589
    hmm... I am still not sure what is the problem. Generally "sentinel" refers to some kind of flag, e.g., a flag used to control a loop. Why not post the smallest and simplest code that demonstrates the problem?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    It's truly amazing what "da interweb" and a search for an error message in the manual will reveal...
    sentinel
    This function attribute ensures that a parameter in a function call is an explicit NULL. The attribute is only valid on variadic functions. By default, the sentinel is located at position zero, the last parameter of the function call. If an optional integer position argument P is supplied to the attribute, the sentinel must be located at position P counting backwards from the end of the argument list.

    __attribute__ ((sentinel))
    is equivalent to
    __attribute__ ((sentinel(0)))


    The attribute is automatically set with a position of 0 for the built-in functions execl and execlp. The built-in function execle has the attribute set with a position of 1.

    A valid NULL in this context is defined as zero with any pointer type. If your system defines the NULL macro with an integer type then you need to add an explicit cast. GCC replaces stddef.h with a copy that redefines NULL appropriately.

    The warnings for missing or incorrect sentinels are enabled with -Wformat.
    Short answer, your exec call is missing NULL.

    Or whatever...
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  7. #7
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Salem View Post
    It's truly amazing what "da interweb" and a search for an error message in the manual will reveal...

    Short answer, your exec call is missing NULL.

    Or whatever...
    Yes, this is what I read too and I said, error_popup doesn't use one. But I agree...whatever.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21