Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Why ascii_isspace() instead of ::isspace()?
Forum Updated to NodeBB v4.3 + New Features

Why ascii_isspace() instead of ::isspace()?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 716 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    marcbf
    wrote on last edited by
    #1

    I've noticed that calls to ::isspace() have been replaced by calls to ascii_isspace() as defined in qlocale_p.h.

    Can someone tell me the reasoning behind that? Both implementations seem to do the same thing. I've been googling but all I've found is this.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      The commit message says it all 'to replace the locale-dependent isspace(3)' - isspace() is locale dependent but a non-locale dependent function was needed.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      M 1 Reply Last reply
      3
      • Christian EhrlicherC Christian Ehrlicher

        The commit message says it all 'to replace the locale-dependent isspace(3)' - isspace() is locale dependent but a non-locale dependent function was needed.

        M Offline
        M Offline
        marcbf
        wrote on last edited by marcbf
        #3

        Doesn't that depend on the version of isspace() used?

        As far as I know ::isspace(), the one defined in <cctype>, isn't locale-dependent, or am I missing something?

        By the way, I'm only asking out of curiosity, so thanks for indulging me. :-)

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @marcbf said in Why ascii_isspace() instead of ::isspace()?:

          isn't locale-dependent, or am I missing something?

          http://www.cplusplus.com/reference/cctype/isspace/ says it's locale dependent

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          M 1 Reply Last reply
          4
          • Christian EhrlicherC Christian Ehrlicher

            @marcbf said in Why ascii_isspace() instead of ::isspace()?:

            isn't locale-dependent, or am I missing something?

            http://www.cplusplus.com/reference/cctype/isspace/ says it's locale dependent

            M Offline
            M Offline
            marcbf
            wrote on last edited by marcbf
            #5

            I see. I must have missed that. I've always worked under the assumption that the regular isspace() only checks in the default C locale and that you should use the version which takes the locale as a parameter to have locale support.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved