Thread: what's a "sentinel"?

  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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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.

  3. #3
    Registered User slingerland3g's Avatar
    Join Date
    Jan 2008
    Location
    Seattle
    Posts
    603
    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 11:39 AM.

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    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?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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.

  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