Results 1 to 19 of 19

Thread: very funny MSVC compiler

  1. #1

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Angry very funny MSVC compiler

    GREAT!

    Well it's time again for xlocale(467) : fatal error C1001: INTERNAL COMPILER ERROR, at the bolded line
    Code:
    template<class _E>
            class ctype : public ctype_base {
    public:
            typedef _E char_type;
            bool is(mask _M, _E _C) const
                    {return (do_is(_M, _C)); }
            const _E *is(const _E *_F, const _E *_L, mask *_V) const
                    {return (do_is(_F, _L, _V)); }
            const _E *scan_is(mask _M, const _E *_F,
                    const _E *_L) const
                    {return (do_scan_is(_M, _F, _L)); }
            const _E *scan_not(mask _M, const _E *_F,
                    const _E *_L) const
                    {return (do_scan_not(_M, _F, _L)); }
            _E tolower(_E _C) const
                    {return (do_tolower(_C)); }
            const _E *tolower(_E *_F, const _E *_L) const
                    {return (do_tolower(_F, _L)); }
            _E toupper(_E _C) const
                    {return (do_toupper(_C)); }
            const _E *toupper(_E *_F, const _E *_L) const
                    {return (do_toupper(_F, _L)); }
            _E widen(char _X) const
                    {return (do_widen(_X)); }
            const char *widen(const char *_F, const char *_L,
                    _E *_V) const
                    {return (do_widen(_F, _L, _V)); }
            char narrow(_E _C, char _D = '\0') const
                    {return (do_narrow(_C, _D)); }
            const _E *narrow(const _E *_F, const _E *_L, char _D,
                    char *_V) const
                    {return (do_narrow(_F, _L, _D, _V)); }
            static locale::id id;
            explicit ctype(size_t _R = 0)
                    : ctype_base(_R) {_Init(_Locinfo()); }
            ctype(const _Locinfo& _Lobj, size_t _R = 0)
                    : ctype_base(_R) {_Init(_Lobj); }
            static size_t __cdecl _Getcat()
                    {return (_LC_CTYPE); }
    _PROTECTED:
            virtual ~ctype()
                    {if (_Ctype._Delfl)
                            free((void *)_Ctype._Table); }
    protected:
            void _Init(const _Locinfo& _Lobj)
                    {_Ctype = _Lobj._Getctype(); }
            virtual bool do_is(mask _M, _E _C) const
                    {return ((_Ctype._Table[narrow(_C)] & _M) != 0); }
            virtual const _E *do_is(const _E *_F, const _E *_L,
                    mask *_V) const
                    {for (; _F != _L; ++_F, ++_V)
                            *_V = _Ctype._Table[narrow(*_F)];
                    return (_F); }
            virtual const _E *do_scan_is(mask _M, const _E *_F,
                    const _E *_L) const
                    {for (; _F != _L && !is(_M, *_F); ++_F)
                            ;
                    return (_F); }
            virtual const _E *do_scan_not(mask _M, const _E *_F,
                    const _E *_L) const
                    {for (; _F != _L && is(_M, *_F); ++_F)
                            ;
                    return (_F); }
            virtual _E do_tolower(_E _C) const
                    {return ((_E)widen((char)_Tolower(narrow(_C), &_Ctype))); }
            virtual const _E *do_tolower(_E *_F, const _E *_L) const
                    {for (; _F != _L; ++_F)
                            *_F = (_E)_Tolower(*_F, &_Ctype);
                    return ((const _E *)_F); }
            virtual _E do_toupper(_E _C) const
                    {return ((_E)widen((char)_Toupper(narrow(_C), &_Ctype))); }
            virtual const _E *do_toupper(_E *_F, const _E *_L) const
                    {for (; _F != _L; ++_F)
                            *_F = (_E)_Toupper(*_F, &_Ctype);
                    return ((const _E *)_F); }
            virtual _E do_widen(char _X) const
                    {return (_WIDEN(_E, _X)); }
            virtual const char *do_widen(const char *_F, const char *_L,
                    _E *_V) const
                    {for (; _F != _L; ++_F, ++_V)
                            *_V = _WIDEN(_E, *_F);
                    return (_F); }
            virtual char do_narrow(_E _C, char) const
                    {return ((char)_NARROW(_E, _C)); }
            virtual const _E *do_narrow(const _E *_F, const _E *_L,
                    char, char *_V) const
                    {for (; _F != _L; ++_F, ++_V)
                            *_V = (char)_NARROW(_E, *_F);
                    return (_F); }
    private:
            _Locinfo::_Ctypevec _Ctype;
            };
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  2. #2
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    Not related to the post, but what are Bork Expression Templates?
    Alcohol & calculus don't mix.
    Never drink & derive.

  3. #3
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    It's Ked's nifty new paradigm

    You can combine seemingly unrelated types and it the compiler (using templates and inlining) will extract the necessary parts.

    Although I'm not totally sure - despite having been discussing it with him for weeks I still don't understand it

    Although at its simplest level:
    Code:
    pounds x = 2;
    ounces z;
    
    z = x;
    x now has the value 28 (2 x 14)

    Then if you tried to convert it back again, it would be divided.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  4. #4

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Expression templates are used to optimize the use of registers, I'm also using them in a new paradigm Bork, which opens a new dimension in C++, the Bork environment allows infinitely "polymorphic" typing at designtime, unlike the strong typed environment in C++ it will provide the generic flexibility when implementing, combining and extending objects as well as algoritms,

    An example of what you can do currently with some types:

    MyWindow+=Rect(1,2,3,4)+Size(10)*Rect(1,2,3,4)+Width(30)-Square(2)+Convert<my2dprojector>(3dvector(x,y,z))+Green+RGB(3,24,123)+Elephant;

    would move the window 27,13,47,43+the projection of the 3d point, and add the color 3,255,123 to current window color, but the elephant would have no effect on the window, on the other hand it won't slow down the performance. In fact doing this with regular types would take both lots of runtime performance as well as design time struggling. With Bork this is all trivial
    Last edited by kedaman; Dec 31st, 2001 at 07:56 AM.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    Uhh...cool
    Alcohol & calculus don't mix.
    Never drink & derive.

  6. #6
    Zaei
    Guest
    kedaman, you are either brilliant, or insane =).

    Z.

  7. #7

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    parksie told me I was mad yesterday I guess I only know what madness means
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  8. #8
    Hyperactive Member
    Join Date
    Sep 2001
    Posts
    396
    Hi Kedaman, are you doing all these work on VC?

    I thought (after reading your previous posts) that VC is unsuitable for writing templates as it doesn't fully support templates as well as hmm... Borland C++ Builder.
    I'm a VB6 beginner.

  9. #9

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Yep, I'm struggling as shown with VC Borland has better conformance but the optimations really suck (at least according to parksie) so I won't bother switching.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  10. #10
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    VC++ 7 (aka .NET) is a lot better with templates, and gives you more help on where you've gone wrong.

    It claims to do partial specialisation now - however, the most conformant is still GCC...pity it doesn't install on Windows.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  11. #11
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    What is _Locinfo? What is _CTypeevec? I guess you're rewriting ctype.h to a C++ version that takes full care of locales and such automatically, right? What is mask? What is _PROTECTED? Is it a macro that becomes either public or protected, depending on compiler?

    Really Keda, you can't expect us to know all your weird templates. Have you written a single real, pure class in the last three month?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  12. #12
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Er...that code he posted is from the standard headers

    Which, incidentally, do all the locale stuff
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  13. #13
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Oh...
    So, the standard headers don't compile?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  14. #14
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Normally they would. However, if it has problems compiling the type when used with whatever you decide to parameterise it with, then it shows up inside the template.

    Also, you can bugger up the internals by putting other totally unrelated code that's broken it.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  15. #15

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Internal Compiler Error, I don't know how the compiler works but certainly it doesn't (in this case).
    I'm about to write my own language, as even with the right macro's that hide the template specification syntax, it looks messy.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  16. #16
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    First you write the ultimative extension to C++ and then you write a new language?
    Seems like you're tricking yourself

    But I'm always on your side
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  17. #17

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Nope, it will compile to C++ code
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  18. #18
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    Originally posted by parksie
    x now has the value 28 (2 x 14)
    *Ahem* I think you mean 32 (2 x 16)
    Harry.

    "From one thing, know ten thousand things."

  19. #19
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Oh buggery...it's 14 pounds to the stone, isn't it?

    Oh well this is probably why nobody uses imperial anymore
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width