- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Linux 2.6.32
Intel compiler: icpc version 13.0.1 (gcc version 4.4.6 compatibility)
#include <iostream> #include <sys/types.h> int main() { std::cerr << sizeof (__uint128_t) << std::endl; return 0; } Output: 16
So, type __uint128_t exists. However, working with __uint128_t produces compilation and run errors.
Programs:
------------------ File int01.cpp #include <cstdint> int main() { uint128_t val128 = 0; return 0; }
------------------ File int02.cpp #include <cstdint> int main() { __uint128_t val128 = 0; return 0; }
------------------ File int03.cpp #include <iostream> #include <cstdint> int main() { __uint128_t val128 = 0; std::cerr << val128 << std::endl; return 0; }
Compilations:
> icpc int01.cpp /usr/include/c++/4.4.6/c++0x_warning.h(31): catastrophic error: #error directive: This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options. #error This file requires compiler and library support for the upcoming \ ^
compilation aborted for int01.cpp (code 4)
> icpc int01.cpp -std=c++0x int01.cpp(4): error: identifier "uint128_t" is undefined uint128_t val128 = 0; ^
compilation aborted for int01.cpp (code 2)
> icpc int02.cpp -std=c++0x // No errors
> icpc int03.cpp -std=c++0x
int03.cpp(6): error: more than one operator "<<" matches these operands: function "std::basic_ostream<_CharT, _Traits>::operator<<(long) [with _CharT=char, _Traits=std::char_traits<char>]" function "std::basic_ostream<_CharT, _Traits>::operator<<(unsigned long) [with _CharT=char, _Traits=std::char_traits<char>]" function "std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT=char, _Traits=std::char_traits<char>]" function "std::basic_ostream<_CharT, _Traits>::operator<<(short) [with _CharT=char, _Traits=std::char_traits<char>]" function "std::basic_ostream<_CharT, _Traits>::operator<<(unsigned short) [with _CharT=char, _Traits=std::char_traits<char>]" function "std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT=char, _Traits=std::char_traits<char>]" function "std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT=char, _Traits=std::char_traits<char>]" function "std::basic_ostream<_CharT, _Traits>::operator<<(long long) [with _CharT=char, _Traits=std::char_traits<char>]" function "std::basic_ostream<_CharT, _Traits>::operator<<(unsigned long long) [with _CharT=char, _Traits=std::char_traits<char>]" function "std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT=char, _Traits=std::char_traits<char>]" function "std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT=char, _Traits=std::char_traits<char>]" function "std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT=char, _Traits=std::char_traits<char>]" operand types are: std::ostream << __uint128_t std::cerr << val128 << std::endl; ^
compilation aborted for int03.cpp (code 2)
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
CRT function: what does it mean?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
CRT function: what does it mean?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
printf (..., "%llx", ) doesn't work for uint128.
Could you send a small program with uint128 that prints uint128-value?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
// <cstdint> -*- C++ -*-
// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free Software Foundation; either version 3, or (at your option) // any later version.
// This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>.
/** @file include/cstdint * This is a Standard C++ Library header. */
#ifndef _GLIBCXX_CSTDINT #define _GLIBCXX_CSTDINT 1
#pragma GCC system_header
#ifndef __GXX_EXPERIMENTAL_CXX0X__ # include <c++0x_warning.h> #endif
#if defined(_GLIBCXX_INCLUDE_AS_TR1) # error C++0x header cannot be included from TR1 header #endif
#include <bits/c++config.h>
// For 8.22.1/1 (see C99, Notes 219, 220, 222) #if _GLIBCXX_HAVE_STDINT_H # ifndef __STDC_LIMIT_MACROS # define _UNDEF__STDC_LIMIT_MACROS # define __STDC_LIMIT_MACROS # endif # ifndef __STDC_CONSTANT_MACROS # define _UNDEF__STDC_CONSTANT_MACROS # define __STDC_CONSTANT_MACROS # endif # include <stdint.h> # ifdef _UNDEF__STDC_LIMIT_MACROS # undef __STDC_LIMIT_MACROS # undef _UNDEF__STDC_LIMIT_MACROS # endif # ifdef _UNDEF__STDC_CONSTANT_MACROS # undef __STDC_CONSTANT_MACROS # undef _UNDEF__STDC_CONSTANT_MACROS # endif #endif
#if defined(_GLIBCXX_INCLUDE_AS_CXX0X) # include <tr1_impl/cstdint> #else # define _GLIBCXX_INCLUDE_AS_CXX0X # define _GLIBCXX_BEGIN_NAMESPACE_TR1 # define _GLIBCXX_END_NAMESPACE_TR1 # define _GLIBCXX_TR1 # include <tr1_impl/cstdint> # undef _GLIBCXX_TR1 # undef _GLIBCXX_END_NAMESPACE_TR1 # undef _GLIBCXX_BEGIN_NAMESPACE_TR1 # undef _GLIBCXX_INCLUDE_AS_CXX0X #endif
#endif // _GLIBCXX_CSTDINT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks.
But problem is not only with print.
For instance, std::numeric_limits<__uint128_>::max() returns 0.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
#include <iostream> #include <iomanip> #include <cstdint> int main() { __uint128_t val128 = 0xeeee1234567812345678; unsigned long val64l = static_cast<unsigned long>((val128 << 64) >> 64); unsigned long val64m = static_cast<unsigned long>(val128 >> 64); std::cerr << std::hex << val64l << std::dec << std::endl; std::cerr << std::hex << val64m << std::dec << std::endl; return 0; }
> icpc int03.cpp -std=c++0x
> ./a.out
560800000000 // Expected 1234567812345678
eeee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I need it in a real application.
But "partially supported" feature is worse than non-supported one.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page