public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/35884]  New: defining __need_size_t before including <cstddef> causes error
@ 2008-04-09 10:10 stdin at stdin dot me dot uk
  2008-04-09 11:22 ` [Bug c++/35884] " pcarlini at suse dot de
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: stdin at stdin dot me dot uk @ 2008-04-09 10:10 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 899 bytes --]

When you define __need_size_t before including <cstddef> it only pulls in
size_t, but the cstddef header expects ptrdiff_t there too and fails.
sample code:
--
#define __need_size_t
#include <cstddef>
main() {}
--
error message produced by g++:
$ g++ main.cpp
In file included from main.cpp:2:
/usr/include/c++/4.3/cstddef:55: error: ‘::ptrdiff_t’ has not been declared


-- 
           Summary: defining __need_size_t before including <cstddef> causes
                    error
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: stdin at stdin dot me dot uk
 GCC build triplet: i486-linux-gnu
  GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35884


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/35884] defining __need_size_t before including <cstddef> causes error
  2008-04-09 10:10 [Bug c++/35884] New: defining __need_size_t before including <cstddef> causes error stdin at stdin dot me dot uk
@ 2008-04-09 11:22 ` pcarlini at suse dot de
  2008-04-11  3:37 ` stdin at stdin dot me dot uk
  2008-04-11  6:46 ` jakub at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pcarlini at suse dot de @ 2008-04-09 11:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pcarlini at suse dot de  2008-04-09 11:22 -------
Names starting with __ and _ (see 17.4.3.1 for details) are reserved. That's
exactly the reason why the library uses everywhere and only such names (why,
otherwise?)


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35884


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/35884] defining __need_size_t before including <cstddef> causes error
  2008-04-09 10:10 [Bug c++/35884] New: defining __need_size_t before including <cstddef> causes error stdin at stdin dot me dot uk
  2008-04-09 11:22 ` [Bug c++/35884] " pcarlini at suse dot de
@ 2008-04-11  3:37 ` stdin at stdin dot me dot uk
  2008-04-11  6:46 ` jakub at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: stdin at stdin dot me dot uk @ 2008-04-11  3:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from stdin at stdin dot me dot uk  2008-04-11 03:36 -------
You define __need_size_t when you want to pull in the definition of size_t but
not other typedefs/functions. It's the standard way to get the size_t type.


-- 

stdin at stdin dot me dot uk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35884


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/35884] defining __need_size_t before including <cstddef> causes error
  2008-04-09 10:10 [Bug c++/35884] New: defining __need_size_t before including <cstddef> causes error stdin at stdin dot me dot uk
  2008-04-09 11:22 ` [Bug c++/35884] " pcarlini at suse dot de
  2008-04-11  3:37 ` stdin at stdin dot me dot uk
@ 2008-04-11  6:46 ` jakub at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-04-11  6:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2008-04-11 06:45 -------
No, that is a way how the implementation does that internally.  That's
certainly not something you are allowed to do in random applications or
libraries.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35884


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-04-11  6:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-09 10:10 [Bug c++/35884] New: defining __need_size_t before including <cstddef> causes error stdin at stdin dot me dot uk
2008-04-09 11:22 ` [Bug c++/35884] " pcarlini at suse dot de
2008-04-11  3:37 ` stdin at stdin dot me dot uk
2008-04-11  6:46 ` jakub at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).