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

  • SEARCH
  • Home
  • 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 8614269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:04:56+00:00 2026-06-12T05:04:56+00:00

Recent versions of gcc and clang on Fedora Linux compile the following program without

  • 0

Recent versions of gcc and clang on Fedora Linux compile the following program without error:

#include <ctype.h>
#include <stdio.h>

int main(int argc, char *argv[]) {
    char c = 'a';
    if islower(c)
        printf("%d", c);
    else
        printf("%c", c);
    return 0;
}

This is with gcc 4.7.2 and clang 3.0. On my Mac, in contrast, both gcc 4.2.1 and Apple clang 4.1 complain about missing parentheses in the “if islower(c)” line, as expected. In all cases, I ran the compilers with “-std=c99”.

Is this a bug in recent versions of gcc and clang, a quirk in the C language, or something else? The C99 standard (http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf p. 133) appears to mandate parentheses around if expressions in all cases.

  • 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-12T05:04:57+00:00Added an answer on June 12, 2026 at 5:04 am

    I just looked through the ctype.h file located in /usr/include/ctype.h and found the following definition for islower:

    #define islower(c)  __isctype((c), _ISlower)
    

    Going to the definition for __isctype() I find:

    #define __isctype(c, type) \
      ((*__ctype_b_loc())[(int) (c)] & (unsigned short int) type)
    

    So your code if islower(c) expands to:

    if ((*__ctype_b_loc())[(int) (c)] & (unsigned short int) _ISlower)
    

    Which, as unwind said, added the parenthesis during expansion.

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

Sidebar

Related Questions

When I compile C code in recent version of gcc, I am getting the
In recent versions, OpenCV allows easy creation of keypoint detectors, descriptors or matchers using
In recent versions of python, one can use something like with open('abc.txt') as f:
In most of recent versions of Windows (XP, Vista, 7) it is possible to
The move in recent versions of Python to passing a key function to sort()
I'm trying to find any research/academic/journal papers/articles that analyze recent versions of Qt and
I downloaded the most recent version of Android for Linux (android-sdk_r05-linux_86.tgz). I was trying
I am getting a warning in eclipse (the most recent version) for the following
Here's the situation, I've got a C++ codebase which is using a recent GCC
Following question How do applications resolve to different versions of shared libraries at run

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.