Thread: why does this crash?

  1. #16
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    As a side note to the original post: I ran the program as posted, and it works fine, but if I type in "1a" as the input, it will get into an infinite loop and eventually run out of memory. It takes a quite long time, since it's outputting the string "Enter a number or -1 to end..." many many times before it fails (at least on my machine).

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  2. #17
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by manav View Post
    Last thing I want to hear is the command line or script tools are things of the past.
    They are part of advanced stuff. No, neither of them is better, over either, but, outdated? Someone please testify Elysia's comments.
    Did I say they were? I mentioned IDEs are the future, that's all. IDEs will always be easier (OK, some will disagree on this, but anyway) than command lines or scripts.
    The further we go into the future, the more feature rich the IDEs are going to become, as well as easier, probably. Therefore, in terms of ease and usability, I would a good IDE > command line tools & scripts.

    Command lines and scripts exists today because no one has really invented anything to replace them. Relics of the old, yet relevant today.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #18
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    The reason scripting and command line programs continue to exist and be used is because it is easier to implement advanced functionality in them than it is in a interactive program (eg IDE, GUI, etc).

    While some development environments make it easier to develop graphical or text based user interfaces than was possible in the past, it is basically easier to parse a string (eg command line input) than it is to respond to various inputs or events associated with a user interface. It is possible to develop an IDE with all the advanced features of a command-line equivalent, but the effort of getting it right (correct "look and feel", correct responses to all possible sets of inputs,all the other things that contribute to "usability") is greater. Getting those sorts of things right requires consistent rules of interface design to achieve usability (an active area of research) and then development of high quality tools that allow development of user-interfaces using those rules (IDE is another area with considerable investment happening) and then programmer discipline to use them (a requirement against which many programmers require a lot of development).

    This sort of thing is one of the reasons that vendors like Apple (MacOS attempts to provide all necessary power through GUI, so the user rarely needs to employ a command line program) charge a premium for their products. [And, no, I am not a MacOS user -- I pay less and use windows, but find I must sometimes resort to the command line].
    Last edited by grumpy; 05-21-2008 at 05:48 AM.

  4. #19
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Both Microsoft and Apple, however, are pushing forward GUIs. I don't know about Apple, but Microsoft is certainly trying to push their own techologies on us to make it easier to develop feature-rich and pretty GUIs.
    In the future, the line between command line and GUIs is going to blur even more so, I think. And yet, will Linux still retort to their mostly command-line approach, I wonder?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #20
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by manav View Post
    Just understand one thing, command line and script tools are like a powerful programming language. You can never express in any kind of advanced GUI what you can express in a programming language, for example, say C++.
    Nay.
    A GUI can express a lot of things a scripted language can, but it depends on the complexity and the aim. Expressing C++ is a GUI would be next to impossible (but DOABLE), but if you have the time and determination, it's possible. I dare say it would be a quality program too, if done right.

    The GUI and command line/script tools have completely different benefits and fields of work. Period.
    No, no period.
    It can be done either ways.
    Sure, you can make a compiler command line, but then again, you can make it as a dll or another form of code base - equally possible. It's just that we do not do this for various reasons - but it doesn't mean we cannot, or that it is targetted at a different field of work.
    It may just be a bad habit, or disadvantages to it, but it's certainly possible.

    You can say it's legacy. We still use old units for physics, for example, or food, even though newer, better units exist. Legacy.
    Last edited by Elysia; 05-21-2008 at 06:12 AM.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #21
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Yes, let's not claim one is better then the other or that something is not doable in the other or that one only works in specialized fields. That way no one (or fewer) will complain.
    I'd like to see C++ expressed as a GUI I mean, it would be cool to see XD, not that we need it.

    Oh yeah, and no hard feelings. No hatred towards anyone here. Don't take anything serious
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #22
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Quote Originally Posted by Elysia View Post
    Did I say they were? I mentioned IDEs are the future, that's all. IDEs will always be easier (OK, some will disagree on this, but anyway) than command lines or scripts.
    The further we go into the future, the more feature rich the IDEs are going to become, as well as easier, probably.
    IDEs slow me down terribly when I'm editing code. I can't imagine anyone being more productive using one. What I can imagine and in fact have seen, are programmers who know how to push buttons, right-click, mouse-over, but are lost outside of the IDE. Even something as simple as browsing and editing source is a challenge, let alone compiling, linking, and running a simple test program.

  8. #23
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    IDEs slow me down terribly when I'm editing code. I can't imagine anyone being more productive using one.
    I find that claim rather strange. It seems to me that an IDE should be no worse than using the tools separately, assuming that it does integrate those tools and allow you to configure them appropriately.

    What I can imagine and in fact have seen, are programmers who know how to push buttons, right-click, mouse-over, but are lost outside of the IDE. Even something as simple as browsing and editing source is a challenge, let alone compiling, linking, and running a simple test program.
    I do not see a problem with that. All that shows is that those programmers are only familiar with the tool that they use. Remove that tool and they flounder until they learn to use the new set of tools that they have at hand.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  9. #24
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by laserlight View Post
    I find that claim rather strange. It seems to me that an IDE should be no worse than using the tools separately, assuming that it does integrate those tools and allow you to configure them appropriately.
    I agree. The common scenario here is that someone is used to editor X, and the keyboard mapping/functionality in the IDE editor is noticeably different from that. It does take some extra time to learn a new editor, and if you are one of those people who can remember some keyboard shortcut only after using it 200 times, it takes some effort to learn the new set of things. [I confess that quite often I press Emacs commands in the Eclipse-based tools we use here. Most of the time that's not a problem (aside from it not doing what I want), but when I do CTRL-X CTRL-S, it sometimes cuts a big piece of code and then saves the file, rather than just saving the file...].

    I do not see a problem with that. All that shows is that those programmers are only familiar with the tool that they use. Remove that tool and they flounder until they learn to use the new set of tools that they have at hand.
    Indeed. Tools you are not used to, whether that is just a different hammer, IDE or command line tools. Producing software is difficult (once it gets to a large and complex enough size), and getting everything right is not always easy, whether you have an IDE or use Makefiles, batch files, or some other way to build your source into an executable result.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  10. #25
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Quote Originally Posted by laserlight View Post
    I find that claim rather strange. It seems to me that an IDE should be no worse than using the tools separately, assuming that it does integrate those tools and allow you to configure them appropriately.
    For me, fullscreen GVim is largely preferable to the 1/4 screen edit window in an IDE, switching from mouse to keyboard and back, getting interrupted by Intellisense for things I already knew in the first place, having to hunt for settings to view/edit in various dialogs, etc.

    I do not see a problem with that. All that shows is that those programmers are only familiar with the tool that they use. Remove that tool and they flounder until they learn to use the new set of tools that they have at hand.
    Right, and the tool has abstracted away the process of compiling and linking and even running programs for some. I've seen people fire up an IDE just to run a program that was built with it. When I ask where the generated .obj or .class files are to validate that the build is current, the eyes glaze over.
    Last edited by medievalelks; 05-21-2008 at 07:39 AM.

  11. #26
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    For me, fullscreen GVim is largely preferable to the 1/4 screen edit window in an IDE
    I maintain that GVim is an IDE

    Anyway, there is no rule that says that IDEs must have a 1/4 screen edit window (I think they usually have a 1/2 screen edit window or larger by default, anyway), or that they cannot have a full screen mode (and some do).

    switching from mouse to keyboard and back
    There is no rule that says that one must switch between mouse to keyboard and back with IDEs. If there was such a rule, it would apply to all text editors too.

    getting interrupted by Intellisense for things I already knew in the first place
    Disable unwanted features.

    having to hunt for settings to view/edit in various dialogs
    Once you know where they are, you no longer need to hunt for them. If you still need to hunt for them, then perhaps the user interface design is at fault. That would be different from saying that IDEs inherently harm productivity.

    Right, and the tool has abstracted away the process of compiling and linking and even running programs for some. I've seen people fire up an IDE just to run a program that was built with it. When I ask where the generated .obj or .class files are to validate that the build is current, the eyes glaze over.
    Well, it sounds like the Law of Leaky Abstractions is at work here. However, I do not think that is a problem with the tool, but with the programmer. After all, if the programmer really is familiar with what the IDE does, then the programmer would not have that glazed look.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  12. #27
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    These are just my personal preferences, mind you. I may be a special case, as on certain projects I act as coder, builder, and deployer, which is why I need to know how things are built, what and where the artifacts are, etc. On others I may be editing C++, Java, Shell scripts, and Perl code in the same week, and GVim works for all of them exactly the same way.

  13. #28
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I find it peculiar that you complain about those specific features out of all an IDE may offer. But a good IDE will allow you to specify where files end up, disable "unwanted" features (why anyone would want to disable IntelliSense, I have no idea), and all that.
    Sure, if it works for you, then all is fine, but I do fine it a little strange that you would complain at that of everything.
    Not working in an IDE for me would slow me down greatly, I would think. That the IDE abstracts away things is really nice. No need to separately compile and link files.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  14. #29
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Quote Originally Posted by Elysia View Post
    I find it peculiar that you complain about those specific features out of all an IDE may offer.
    Editing code is what I do most, so the default window size, key map, Intellisense behavior, etc. are important to me. Sure, I can configure one version of one IDE on one build machine at one client, but then I have to keep repeating that process for the next project or gig. I thought that Eclipse and its myriad plugins might be a good solution to the consistency problem, but it's a hog of a program.

    I do like the cross-referencing you get in an IDE, but when I need to edit or create a source file, I can do it faster in GVim.
    Last edited by medievalelks; 05-21-2008 at 10:57 AM.

  15. #30
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    So you work with different editors / IDEs / compilers all the time?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Hooking Crash?
    By Elysia in forum Windows Programming
    Replies: 9
    Last Post: 03-15-2008, 01:13 PM
  2. Can not debug a crash
    By hannibar in forum Windows Programming
    Replies: 2
    Last Post: 06-30-2007, 10:02 AM
  3. Dynamic array sizing causes crash
    By Mithoric in forum C++ Programming
    Replies: 3
    Last Post: 12-30-2003, 07:46 AM
  4. FYI: asctime(gmtime(&mytime)) = crash!
    By anonytmouse in forum C Programming
    Replies: 2
    Last Post: 09-29-2003, 02:24 AM
  5. Crash after crash!
    By Dual-Catfish in forum C++ Programming
    Replies: 1
    Last Post: 03-31-2002, 09:32 AM