Slashdot Mirror


User: krischik

krischik's activity in the archive.

Stories
0
Comments
925
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 925

  1. Re:null pointer on Bjarne Stroustrups and More Problems With Programming · · Score: 1

    Thank's - you deserve an "Insightfull" for the Article!

    Martin

  2. strongly typed - in the eye of the beholder on Bjarne Stroustrups and More Problems With Programming · · Score: 1
    and in my eyes a language which allows any of the following is weak:

    unsigned i = -1;
    char x[10]; x[10]='a';
    However:

    unsigned i = static_cast<int> (-1);
    unsigned i = dynamic_cast<int> (-1);
    would be OK. With the later to to raise range_error - sadly the C++ standard comite missed the opportunity to define dynamic_cast for numeric types.

    Yes, you need exceptions from the type system - but they should be exceptions and not default behavior.

    Martin
  3. null pointer on Bjarne Stroustrups and More Problems With Programming · · Score: 1
    I would not believe the comp.lang.c FAQ - only the ISO/IEC 9899:1999 counts. And indeed I have a copy at hand:

    6.3.2.3(3): An integer constant expression with the value 0, or such an expression cast to type void*, is called the null pointer constant. So here you are: 0 is the null pointer constant. Please note the lower caps null - NULL is just a define:

    7.17(3): The macros NULL which expand to an implementation-defined null pointer constant; ...-. But I give you that: there is an "implementation-defined" here - so there might indeed be another possible representation for the null pointer.

    As for using memcpy: how actually are you going to memcpy a 0 or NULL? They both don't have an address to copy from.

    Maybe you meant memset. But memset won't work for NULL either. Look at the prototype:

    void *memset(void *s, int c, size_t n);

    The bad news is: int might not be large enough to hold a pointer (It's defined in 6.3.2.3 as well) and indded is not for x86_64. One is supposed to use intptr_t or uintptr_t.

    Martin
  4. Re:Only it's not C++ on Bjarne Stroustrups and More Problems With Programming · · Score: 1

    You're also forgetting that C has been ANSI/ISO standardized, too. I did mention that C99 defined the null pointer to be 0 as well. But then there is only one compiler which implements the C99 standart [1].

    Silly you - it doesn't matter what the current pointer standard is; the first parameter isn't a pointer, but a window handle (hwnd). Indeed, silly mee. But then how am I supposed to know that the first parameter is a window when a null pointer is passed in (in which case it won't matter is old fashioned NULL or a modern 0 is used)? There is more to strong typing (which C/C++ does not posses) then an error message. There is readablity. For that best would have been an NWND constant or prehaps (hwnd)0.

    Martin

    [1] http://www.comeaucomputing.com/
  5. Re:Coolest and lamest! on Bjarne Stroustrups and More Problems With Programming · · Score: 1

    Almost - procedures don't need the "body" keyword and modern Ada programmers don't CAPS any more. Modern Ada style is lowercase for keywords and Camel_Case for everything else.

    Correct, up to date version ;-):

    http://en.wikibooks.org/wiki/Ada_Programming/Basic

    Martin

  6. Only it's not C++ on Bjarne Stroustrups and More Problems With Programming · · Score: 2, Insightful

    Apart from the fact that the #includes are missing it's not C++. Shure (with the missing includes) it might compile. But it is not the way it is done in C++.

    The C++ (as well as C99) standart define 0 to be the null pointer. With older C standards that was different and there where indeed some platforms with:

    #define NULL ((void*)-1)

    which means that

    if (s && s[0] != '\0')

    won't work. But that' all over now - it's the null pointer is 0 now. on the other hand C++2008 is likely to get an extra null pointer keyword.

    But it does show the greatest problem of C++ programming: Most C++ programmers don't actualy know how C++ works. And just because MS used NULL it does not mean it is current standart.

    Martin

  7. Self send E-Mail on Spam Doubles, Finding New Ways to Deliver Itself · · Score: 1

    You speak from my heard!

    I used to relay my mail myself as well, but no more....

    Martin

  8. commercial unix - yuck! on Mark Shuttleworth Tries To Lure OpenSUSE Devs · · Score: 1

    KDE is a non-starter for commercial desktop environments because of the cost of Qt for commercial users: that's why Sun, IBM, Ubuntu, RedHat, Eclipse, and SuSE are all basing their major products on Gtk+, not Qt.Have you evern seen a "commercial GNOME". I have, on Sun Solaris. And it sucks! Ok, I am a KDE man and don't like GNOME that much anyway but GNOME as it comes from Sun beat's it all in beeing ugly and primitive.

    I think that commercial Unix vedors are just a lazy bunch bundeling the easiers option and even then only bundle the bare minimum.

    Which reminds me: On Solaris I had to use Gedit (until I had a Gvim up and running - the only Gtk+ application I truely like) and Gedit was just Notepad kind of editor. I could swear that a few years ago, before I finally move to KDE for good, Gedit a looked more promising text editor. Has functionality been striped of Gedit? The same way functionality has striped of Evolution and Nautilus?

    For the later two I know for shure - The GNOME comunity has bitten of more functionality then they could swallow bug free. And the the GNOME comunity has declared simlicity the new aim. It's not a bug we can't fix, It's a feature we don't offer any more.

    Which brings me back to the pont simlicity is what commercial users want, not great tools. And they give a f**k that I, in a corse of a week lost at least one working day by having to use Gedit and basic Vi. And another day for me to compile GVim, GNU Grep, GNU Coreutil and GNU Findutil. Now Solaris is almost usable.

    Martin

  9. Well, it's not a us national site. on 40 Years of Ultraman · · Score: -1, Offtopic

    This is "slashdot.org" and not "slashdot.or.us". You may not know it but sites with 3 and 4 character top level domains (.org, .net, .com, .info etc pp) are for international use.

    National sites end with a 2 character top level domain - in the case of the USA it would be ".us".

    Martin

  10. Re:Absolutely... on PC Makers May Be Left On the Shelves · · Score: 1

    Our main system is indeed Linux - hence the reference to Kasbar and our Laptop is ungoing convertion to Linux (have to get it right before I can let the rest of the family to it).

    Still whenever I see a Mac it's soo cool. I am looking at Macs with envy for, well, what must be 20 years now, I might just get one after all.

    Martin

  11. Re:Not surprised on PC Makers May Be Left On the Shelves · · Score: 1

    That comment wasn't neccessary. If I had mod points you would be the first I ever modded down.

    You can't expect everybody do get all the computer acronyms right. And there where programms which have trouble with NTFS - mostly backup programms, system tools (at that time one still used norton utilities) and virus scanner. The same way that some programms - still - have problems with spaces in filenames. Modern OS's are far less forgiving with sluggish programming then the old where.

    I know of users who still use XP with FAT32.

    Martin

  12. Re:Absolutely... on PC Makers May Be Left On the Shelves · · Score: 1

    We the Mac might not be faster but it damm well feels so. Whenever I use a Mac (sadly I don't own one) it stays responsive.

    Windows can grint to a halt where you can't even move the mouse anymore. No joke, when that damm virus scanner kick in on my work computer then I can go for a coffee.

    And Kasbar feels sluggisch all the time while that Mac taskbar thingy is just awsome.

    Desktop operating systems are not about compiling a kernel in 1h or 1h15" - it's about clicking with the mouse and it happens right now.

    Martin

  13. Re:Just gets easier on Microsoft Office Genuine Advantage (OGA) · · Score: 2, Funny

    No, but when somebody says "Just send me a Word-Doc" it becomes easier to say "I don't own Word".

    Martin

  14. Semaphores in Ada on Is Code Verification Finally Good Enough? · · Score: 1

    But Ada does not expose the use of Semaphores - The task model of Ada is based around Rendezvous.

    There are some attempts of Rendezvous based threading for other languages but it proves difficult since you need some inter-task parameter passing mechanism. Remember that a Rendezvous is a bit like a function/procedure call only the parameters are passed from one task to another.

    And parameter passing is a language feature and quite difficult to implement as a library. I know because I tried using by using Observer/Notifier pattern and adding the parameters to the message. But it was never as elegant or worked as flawless an Ada Rendezvous.

    Martin

  15. Re: (So were Pascal, Modula, and Ada.) on Is Code Verification Finally Good Enough? · · Score: 1

    http://www.adacore.com/home/ada_answers/lookwho

    I work for one of the named companies ;-) and for our "mission critical" applications we have no intention to change.

  16. Re:Yes, it works, but it's not easy on Is Code Verification Finally Good Enough? · · Score: 1

    Others answered the question but I can add practical experience here. For A while I tied splint [1] and after after a while it became clear that the greatest problem whas the lack of array bound.

    I tried hard, realy hard to get splints bound checking to work - but in the end it did not work out.

    The project is not stalled since 2004 [2] and for me it is now clear that the "Secure Programming Lint" was a hopeless endeavor.

    As for casting: Ada has about 3 different ways of type convertions and is still provable. The difference here is implicid type conversing. My favorite example:

    unsigned i = -1;

    The result depends on the compiler in particular if it is a 16 bit, 32 bit or 64 bit compiler.

    And last not least: C has been patched to many times. The first C is from about around 1973 and did not feature unsigned (the reason why Unix file I/O features a 2 and not 4 GB limit), struct and arrays. Yep, the [] syntax was patched on later.

    Now speaking of patching the C language: C99 does have propper arrays with bounds attached to them. But there is allmost no compiler which implements this C99 feature. M$ and Borland have no plans for variant arrary, GNU C has it on the bug list for years now (depite the fact that GNU Ada has variant arrarys since the first release from ruffly 1998).

    Martin

    PS: I have programmed in Ada, C, C++, Java and Pascal and my favorite language is now Ada.

    [1] http://www.splint.org/
    [2] http://sourceforge.net/projects/splint

  17. Re:Use a language with build in prooving. on Is Code Verification Finally Good Enough? · · Score: 1

    Well, you are right - you need a Date class. It is all about refined. As long as you don't know the month you can't check the date further the 1..31. It's kind of a first step.

    Once you know the month inside a Date class you can do more checks. But you won't need to check for the date to be >0 or 32 any more - theese cases have allready been handled.

    Martin

  18. Re:4 Dimensional Typing System on Design by Contract in C++? · · Score: 1

    The strongest typed language which I am aware of is Ada - and Ada indeed does not allow implicid type convertins between types. However Ada also has the concept of subtypes and will implicidly convert between them and allows for explicid type conversion. See:

    http://en.wikibooks.org/wiki/Ada_Programming/Type_ System

    All in all I consider the Ada type system very praktical indeed. It allows me express my typing needs in a way I have never seen in any other programming language.

    Martin

  19. Re: (So were Pascal, Modula, and Ada.) on Is Code Verification Finally Good Enough? · · Score: 1

    Well at least Ada still is: http://www.praxis-his.com/sparkada and very successfull as well.

    And Ada isn't dead, it just got another rejuvenation in the form of Ada 2005: http://www.adaic.com/standards/ada05.html.

    So the use of past tense was not appropiate.

    Martin

  20. Use a language with build in prooving. on Is Code Verification Finally Good Enough? · · Score: 1

    There some programming lanugages (Ada, SPARK and Eiffel spring to my mind) which have the verification build in (to some degree). Just in case you wonder how that works here my favorite Ada example:

    type Day_Of_Month is range 1 .. 31;

    Neither Java nor C# allow that kind of controll over integer types. Mind you there is A# (Ada for CLI).

    Martin

  21. 4 Dimensional Typing System on Design by Contract in C++? · · Score: 1

    The mistake you are making (and you are not alone here) is to assume that strongly impies static. But that is not true - the typing system is 4 dimensional:

    static/dynamic: Can a variable change type?
    strong/weak: Are types converted implicidly?
    safe/unsafe: Are data convertions save? This includes dangling pointers!
    nominative/structural: Are types bound to the a more or to the structure?

    Some combinations are more common then other but in theory any combination is possible. And quite often a language us not 100% one or the other.

    Martin

  22. dynamic/static on Design by Contract in C++? · · Score: 1

    dynamic/static is what you mean. Try some reading:

    http://en.wikipedia.org/wiki/Type_system#Types_of_ Types

    Of corse C++ adcocates change the C++ entry to there liking faster then you can corect it but as far as I see it a language which allows:

    unsigned i = -1;

    is not strongly typed. In fact and just for good measure:

    #include <iostream>

    int
    main ()
    {
    unsigned i = -1;

    std::cout << i;

    return i;
    }

    >g++ test.cpp -o test
    /tmp Linux martin@linux2 Mi Sep 27 20:47:18 standart
    >./test
    4294967295

    The printout is neither an exeption dump nor a -1 so C++ is weakly typed.

    Martin

  23. Still using W2000 on Microsoft's Masterpiece of FUD? · · Score: 1

    Well, at work I still use W2000. Companies won't update for the sake of it. This is why Office is need a new and incompatible file format with every new version - to force companties to update so they can open 3rd party documents.

  24. Those who know things will be able to help when th on Microsoft Vista User Interface Guidelines Published · · Score: 1

    "Those who know things will be able to help when things go wrong."

    Sadly UI-Desiners don't care about the "user who knows" any more. In fact: This is the most frustrating thing about Windows. And it is not only Windows - the Linux Desktops are following that trent.

    In fact the GNOME design philosophy is a lot like the text discussed - and in both cases (Windows and GNOME) I feel deprived of options (I use KDE for day to day work).

    Martin

  25. Re:Vim is turning into Emacs.... on A Visual Walkthrough of New Features in Vim 7.0 · · Score: 1

    Even worse: it is an "insert mode" mapping - you don't need to return to normal mode to execute it.