11,126.95 9,105.44 2,359.37 1,645.94 266.88 points
More preprocessor abuse! This time, we're making the standard library cry.
Without typo:
#define typedf
#include<fstream>
With typo:
#define typedef
#include<fstream>
Errors:
In file included from /usr/include/c++/4.9/iosfwd:39:0,
from /usr/include/c++/4.9/ios:38,
from /usr/include/c++/4.9/istream:38,
from /usr/include/c++/4.9/fstream:38,
from a.C:2:
/usr/include/c++/4.9/bits/stringfwd.h:62:33: error: aggregate ‘std::basic_string<char> std::string’ has incomplete type and cannot be defined
typedef basic_string<char> string;
^
/usr/include/c++/4.9/bits/stringfwd.h:68:33: error: aggregate ‘std::basic_string<wchar_t> std::wstring’ has incomplete type and cannot be defined
typedef basic_string<wchar_t> wstring;
^
/usr/include/c++/4.9/bits/stringfwd.h:78:34: error: aggregate ‘std::basic_string<char16_t> std::u16string’ has incomplete type and cannot be defined
typedef basic_string<char16_t> u16string;
^
/usr/include/c++/4.9/bits/stringfwd.h:81:34: error: aggregate ‘std::basic_string<char32_t> std::u32string’ has incomplete type and cannot be defined
typedef basic_string<char32_t> u32string;
^
In file included from /usr/include/wchar.h:36:0,
from /usr/include/c++/4.9/cwchar:44,
from /usr/include/c++/4.9/bits/postypes.h:40,
from /usr/include/c++/4.9/iosfwd:40,
from /usr/include/c++/4.9/ios:38,
from /usr/include/c++/4.9/istream:38,
from /usr/include/c++/4.9/fstream:38,
from a.C:2:
/usr/include/stdio.h:48:25: error: aggregate ‘_IO_FILE FILE’ has incomplete type and cannot be defined
typedef struct _IO_FILE FILE;
^
/usr/include/stdio.h:64:25: error: aggregate ‘_IO_FILE __FILE’ has incomplete type and cannot be defined
typedef struct _IO_FILE __FILE;
^
In file included from /usr/include/c++/4.9/cwchar:44:0,
from /usr/include/c++/4.9/bits/postypes.h:40,
from /usr/include/c++/4.9/iosfwd:40,
from /usr/include/c++/4.9/ios:38,
from /usr/include/c++/4.9/istream:38,
from /usr/include/c++/4.9/fstream:38,
from a.C:2:
/usr/include/wchar.h:106:9: error: ‘__mbstate_t’ does not name a type
typedef __mbstate_t mbstate_t;
^
/usr/include/wchar.h:151:38: error: ‘size_t’ is not a type
const wchar_t *__restrict __src, size_t __n)
^
/usr/include/wchar.h:159:38: error: ‘size_t’ is not a type
const wchar_t *__restrict __src, size_t __n)
^
/usr/include/wchar.h:166:63: error: ‘size_t’ is not a type
extern int wcsncmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
^
/usr/include/wchar.h:176:4: error: ‘size_t’ is not a type
size_t __n) __THROW;
^
In file included from /usr/include/wchar.h:180:0,
from /usr/include/c++/4.9/cwchar:44,
from /usr/include/c++/4.9/bits/postypes.h:40,
from /usr/include/c++/4.9/iosfwd:40,
from /usr/include/c++/4.9/ios:38,
from /usr/include/c++/4.9/istream:38,
from /usr/include/c++/4.9/fstream:38,
from a.C:2:
/usr/include/xlocale.h:42:9: error: ‘__locale_t’ does not name a type
typedef __locale_t locale_t;
^
In file included from /usr/include/c++/4.9/cwchar:44:0,
from /usr/include/c++/4.9/bits/postypes.h:40,
from /usr/include/c++/4.9/iosfwd:40,
from /usr/include/c++/4.9/ios:38,
from /usr/include/c++/4.9/istream:38,
from /usr/include/c++/4.9/fstream:38,
from a.C:2:
/usr/include/wchar.h:183:5: error: ‘__locale_t’ is not a type
__locale_t __loc) __THROW;
^
/usr/include/wchar.h:186:6: error: ‘size_t’ is not a type
size_t __n, __locale_t __loc) __THROW;
^
/usr/include/wchar.h:186:18: error: ‘__locale_t’ is not a type
size_t __n, __locale_t __loc) __THROW;
^
/usr/include/wchar.h:196:8: error: ‘size_t’ does not name a type
extern size_t wcsxfrm (wchar_t *__restrict __s1,
^
/usr/include/wchar.h:207:9: error: ‘__locale_t’ is not a type
__locale_t __loc) __THROW;
^
/usr/include/wchar.h:212:8: error: ‘size_t’ does not name a type
extern size_t wcsxfrm_l (wchar_t *__s1, const wchar_t *__s2,
^
/usr/include/wchar.h:252:8: error: ‘size_t’ does not name a type
extern size_t wcscspn (const wchar_t *__wcs, const wchar_t *__reject)
^
/usr/include/wchar.h:256:8: error: ‘size_t’ does not name a type
extern size_t wcsspn (const wchar_t *__wcs, const wchar_t *__accept)
^
/usr/include/wchar.h:287:8: error: ‘size_t’ does not name a type
extern size_t wcslen (const wchar_t *__s) __THROW __attribute_pure__;
^
/usr/include/wchar.h:306:8: error: ‘size_t’ does not name a type
extern size_t wcsnlen (const wchar_t *__s, size_t __maxlen)
^
[SNIP]
/usr/include/c++/4.9/bits/fstream.tcc:934:35: error: ‘cur’ is not a member of ‘std::ios_base’
__testvalid = this->seekoff(0, ios_base::cur, _M_mode)
^
/usr/include/c++/4.9/bits/fstream.tcc:934:50: error: ‘_M_mode’ was not declared in this scope
__testvalid = this->seekoff(0, ios_base::cur, _M_mode)
^
/usr/include/c++/4.9/bits/fstream.tcc:941:25: error: ‘_M_state_last’ was not declared in this scope
+ _M_codecvt->length(_M_state_last, _M_ext_buf,
^
/usr/include/c++/4.9/bits/fstream.tcc:944:15: error: ‘streamsize’ does not name a type
const streamsize __remainder = _M_ext_end - _M_ext_next;
^
/usr/include/c++/4.9/bits/fstream.tcc:945:13: error: ‘__remainder’ was not declared in this scope
if (__remainder)
^
/usr/include/c++/4.9/bits/fstream.tcc:949:35: error: ‘__remainder’ was not declared in this scope
_M_ext_end = _M_ext_buf + __remainder;
^
/usr/include/c++/4.9/bits/fstream.tcc:951:25: error: ‘_M_state_cur’ was not declared in this scope
_M_state_last = _M_state_cur = _M_state_beg;
^
/usr/include/c++/4.9/bits/fstream.tcc:951:40: error: ‘_M_state_beg’ was not declared in this scope
_M_state_last = _M_state_cur = _M_state_beg;
^
/usr/include/c++/4.9/bits/fstream.tcc:960:2: error: ‘_M_codecvt’ was not declared in this scope
_M_codecvt = _M_codecvt_tmp;
^
/usr/include/c++/4.9/bits/fstream.tcc:960:15: error: ‘_M_codecvt_tmp’ was not declared in this scope
_M_codecvt = _M_codecvt_tmp;
^
/usr/include/c++/4.9/bits/fstream.tcc:962:2: error: ‘_M_codecvt’ was not declared in this scope
_M_codecvt = 0;
^
On my Ubuntu machine, g++-4.9 -std=c++11 -c a.C
generates 1,101,568 glorious bytes of errors, for a score of 1101568/33/3 = 11,126.95.
Comments are not for extended discussion; this conversation has been moved to chat. Alternatively, for discussions about what should or shouldn't count as a duplicate please take the discussion to meta.
– Martin Ender – 2015-06-13T21:18:00.703Three issues with using ideone to validate: It forces source file name to "prog.cpp", it truncates compiler error output to 64kB, and it links, adding extra errors. So it won't be a good validation tool. – Jason C – 2015-06-13T22:43:46.830
I have been using GCC 4.9.2 from the toolchain-test Ubuntu repo. – nneonneo – 2015-06-14T20:57:51.963
What are default options? As far as I know, you can configure the default options of gcc at compile time. – FUZxxl – 2015-06-15T08:40:02.083
@FUZxxl - if you are compiling gcc, then you need to use the default default options of gcc. – Mark Lakata – 2015-06-15T21:03:05.737
@MarkLakata So, the gcc binaries shipped by most Linux distributions are disqualified? – FUZxxl – 2015-06-15T22:41:31.367
@FUZxxl Technically, all gcc binaries are disqualified unless they have the same output as http://ideone.com, which was defined as the reference compiler in the rules.
– Mark Lakata – 2015-06-15T23:17:19.8572Brings back memories: from around 1975 our physics teacher ran an annual "most errors from 10 (hand) punched-cards of Fortran" competition... – TripeHound – 2015-06-16T12:52:04.343