Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9214105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:54:07+00:00 2026-06-18T01:54:07+00:00

Here is the code with the oh so weird errors produced by GCC but

  • 0

Here is the code with the oh so weird errors produced by GCC but not by MSVC (5 errors, cited in comment form at error line) :

/* Match STRING against the filename pattern PATTERN, returning zero if
   it matches, nonzero if not.  */
int GNU_fnmatch (const char* pattern,const char* string,int flags)
{
    register const char *p = pattern, *n = string;
    register unsigned char c;

    #define FNM_CASEFOLD 16
    #define FNM_LEADING_DIR 8

    #define FOLD(c) ((flags & FNM_CASEFOLD) ? tolower (c) : (c))

    while ((c = *p++) != '\0')
    {
        c = FOLD (c);

        switch (c)
        {
        case '?':
            if (*n == '\0')
                return 1;
            else if ((flags & FNM_PATHNAME) && *n == '/')
                return 1;
            else if ((flags & FNM_PERIOD) && *n == '.' &&
                (n == string || ((flags & FNM_PATHNAME) && n[-1] == '/')))
                return 1;
            break;

        case '\\':
            if (!(flags & FNM_NOESCAPE))
            {
                c = *p++;
                c = FOLD (c);
            }
            if (FOLD ((unsigned char)*n) != c)
                return 1;
            break;

        case '*':
            if ((flags & FNM_PERIOD) && *n == '.' &&
                (n == string || ((flags & FNM_PATHNAME) && n[-1] == '/')))
                return 1;

            for (c = *p++; c == '?' || c == '*'; c = *p++, ++n)
            if (((flags & FNM_PATHNAME) && *n == '/') ||
            (c == '?' && *n == '\0'))
                return 1;

            if (c == '\0')
                return 0;

            {
            unsigned char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c;
            c1 = FOLD (c1);
            for (--p; *n != '\0'; ++n)
                if ((c == '[' || FOLD ((unsigned char)*n) == c1) &&
                GNU_fnmatch (p, n, flags & ~FNM_PERIOD) == 0)
                return 0;
            return 1;
            }

        case '[':
            {
            /* Nonzero if the sense of the character class is inverted.  */
            register int not; // Error  1   error : expected unqualified-id before '!' token

            if (*n == '\0')
                return 1;

            if ((flags & FNM_PERIOD) && *n == '.' &&
            (n == string || ((flags & FNM_PATHNAME) && n[-1] == '/')))
                return 1;

            not = (*p == '!' || *p == '^'); // Error    2   error : expected primary-expression before '=' token
            if (not) // Error   3   error : expected primary-expression before ')' token
                ++p;

            c = *p++;
            for (;;)
                {
            register unsigned char cstart = c, cend = c;

            if (!(flags & FNM_NOESCAPE) && c == '\\')
                cstart = cend = *p++;

            cstart = cend = FOLD (cstart);

            if (c == '\0')
                /* [ (unterminated) loses.  */
                return 1;

            c = *p++;
            c = FOLD (c);

            if ((flags & FNM_PATHNAME) && c == '/')
                /* [/] can never match.  */
                return 1;

            if (c == '-' && *p != ']')
                {
                cend = *p++;
                if (!(flags & FNM_NOESCAPE) && cend == '\\')
                    cend = *p++;
                if (cend == '\0')
                    return 1;
                cend = FOLD (cend);

                c = *p++;
                }

            if (FOLD ((unsigned char)*n) >= cstart
                && FOLD ((unsigned char)*n) <= cend)
                goto matched;

            if (c == ']')
                break;
                }
            if (!not) // Error  4   error : expected primary-expression before ')' token
                return 1;
            break;

            matched:;
            /* Skip the rest of the [...] that already matched.  */
            while (c != ']')
                {
            if (c == '\0')
                /* [... (unterminated) loses.  */
                return 1;

            c = *p++;
            if (!(flags & FNM_NOESCAPE) && c == '\\')
                /* XXX 1003.2d11 is unclear if this is right.  */
                ++p;
                }
            if (not) // Error   5   error : expected primary-expression before ')' token
                return 1;
            }
            break;

        default:
            if (c != FOLD ((unsigned char)*n))
            return 1;
        }

        ++n;
    }

    if (*n == '\0')
        return 0;

    if ((flags & FNM_LEADING_DIR) && *n == '/')
    /* The FNM_LEADING_DIR flag says that "foo*" matches "foobar/frobozz".  */
        return 0;

    return 1;
}

I mean, it doesn’t even make sense, pestering for a non-existent ‘!’ token (Error 1)!!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T01:54:09+00:00Added an answer on June 18, 2026 at 1:54 am

    not is a reserved word under C++, but not under C.

    The error is self-explanatory:

    if (!not) // Error  4   error : expected primary-expression before ')' token
            ^ //expecting operand for 'not' to act on, got ')' instead.
    

    Compile with any of the C options in GCC, or change the name.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Getting this weird LINQ error. title = System.Linq.Enumerable+WhereSelectEnumerableIterator`2[System.Xml.Linq.XElement,System.String Here is the code I have:
I need help with a weird runtime error. Here's the code which gives it:
I had a weird problem here. Please check the code below. I do not
I have a really weird and confusing error. Here is my code: {if="$pjax ===
There is a weird code here that I need to make work.. can you
This is a fairly weird case, you can see the code here: http://jsfiddle.net/zpZtH/2/
I've stuck into some weird problem. Here is the code AccountsController.cs // GET /api/accounts
So I've noticed some very weird behaviour from my program. Here's a simplified code
The title may sound weird. Well, it is. Here's an approximation of my code
Ok the error is showing up somewhere in this here code if($error==false) { $query

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.