Party Vibe

Register

Welcome To

who can spot the flaw in this code?

Forums Life Computers, Gadgets & Technology who can spot the flaw in this code?

  • This topic is empty.
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • Apparently it took two engineers and a week to suss out why any errors did not trigger the handlng routine..

    int SUCCESS = 1;
    int status = getStatus();

    logger.debug(“Got Status:” + status);
    while(SUCCESS) {
    //Do all the clever things

    status = getStatus();
    logger.debug(“Got Status:” + status);
    }[/CODE][CODE]int SUCCESS = 1;
    int status = getStatus();

    logger.debug(“Got Status:” + status);
    while(SUCCESS) {
    //Do all the clever things

    status = getStatus();
    logger.debug(“Got Status:” + status);
    }[/CODE]

    A total guess my friend as I couldn’t write a single line of code (and tbh I started writing a much longer and probably wronger answer) but I see no code that tells the system what to do in the event of anything but success. If whatever came before was successful, the code returns a 1 and continues (I am guessing) so if anything but total success occurs, there should be something there to return a 0 and then send it to the debugger or whatever.

    Anywhere near?


      Staff

      @General Lighting 977445 wrote:

      Apparently it took two engineers and a week to suss out why any errors did not trigger the handlng routine..

      int SUCCESS = 1;
      int status = getStatus();

      logger.debug(“Got Status:” + status);
      [COLOR=#ff0000] while(SUCCESS) {[/COLOR]
      //Do all the clever things

      status = getStatus();
      logger.debug(“Got Status:” + status);
      }[/CODE]

      while(status==SUCCESS) {

      Not sure if this work, but try.

      [COLOR=#000000][FONT=Arial]
      [/FONT][/COLOR][CODE]int SUCCESS = 1;
      int status = getStatus();

      logger.debug(“Got Status:” + status);
      while(SUCCESS) {
      //Do all the clever things

      status = getStatus();
      logger.debug(“Got Status:” + status);
      }[/CODE]

      while(status==SUCCESS) {

      Not sure if this work, but try.


      What language is that? Looks remarkably easy to read so am gonna guess at python?


        Staff

        And have a look at this site GL.

        It’s really good for learning and testing codes you’ve already made.

        W3Schools Online Web Tutorials

        Maybe the REAL issue with that code is that it written and debugged by women HAHAHAHAHAHAHAHAHA.

        @MrsRobinson 977456 wrote:

        while(status==SUCCESS) {

        Not sure if this work, but try.


        a possible solution (there might be “cleverer” ones which save memory but we are not in 1980s/90s any more and even a chip for an embedded system in a tea kettle probably has 128K RAM)

        the biggest flaw is the while loop doesn’t actually check the status returned but the defined SUCCESS value, (and nothing else)

        so it would be equivalent to

        Code:
        while(1) { // as SUCCESS is defined as 1
        status = getStatus();
        logger.debug(“Got Status:” + status);
        // and that would run in an infinite loop

        }

        the language used is C (which might have also made the debugging harder as there are loads of obscure ways code can fail if written badly)

        @tryptameanie 977459 wrote:

        Maybe the REAL issue with that code is that it written and debugged by women HAHAHAHAHAHAHAHAHA.

        Some sisters do a decent job of it (it is because of Sister Keller BVM my generation was taught programming in the first place). There are many other nuns who have become computer science profs; some of them even more recent (especially in areas like Detroit) – they tend to specialise in the more advanced stuff with really hard maths..

        https://en.wikipedia.org/wiki/Mary_Kenneth_Keller

        Hey I know GL :). I havetremendous respect for the female intellect, especially MrsRobinsons, I do like to take the piss out of them howeer lol.

        @tryptameanie 977506 wrote:

        Hey I know GL :). I havetremendous respect for the female intellect, especially MrsRobinsons, I do like to take the piss out of them howeer lol.

        Although I remember in junior school that nuns were actually very good maths teachers and not as harsh as claimed to be I only recently learned just how many religious sisters had contributed to computer science in the 20th and 21st century.

        Even in my secular high school there was this maths teacher who was a “stealth nun” (not all of them have to wear the habit but she dressed plainly and was always called “Miss” and appeared older than her actual age).

        She would teach every set in the school and any extra classes she could during the week – at weekends she’d go to Church and help the youth group and once explained how she taught them to fit some large tent into a field using trigonometry. She definitely gave the impression of devoting her entire life to Maths and Jesus….

        TBH the same applies across other many religions; prayers often involve counting a lot of items at a defined time of day…

        While I have no experience of nuns bar them running away from me, the head of maths in my comprehensive school (Mrs Sandra Land) was awesome and incredibly intelligent (until I had questions about higher dimensional mathematics, matrices and stuff, that she came undone). No question women are every bit as intelligent men but as much as most would never admit it, I think women are actually still suppressed somewhat in fieklds like science and maths and not because of lackof ability. More likely because they turn into totally unreasonable bitches for 5 days every month.

        @tryptameanie 977512 wrote:

        While I have no experience of nuns bar them running away from me, the head of maths in my comprehensive school (Mrs Sandra Land) was awesome and incredibly intelligent (until I had questions about higher dimensional mathematics, matrices and stuff, that she came undone). No question women are every bit as intelligent men but as much as most would never admit it, I think women are actually still suppressed somewhat in fieklds like science and maths and not because of lackof ability. More likely because they turn into totally unreasonable bitches for 5 days every month.

        Outside the Anglosphere [and even amongst cultures/relgious groups which are claimed not to have as much gender equality] things are often different; I’ve noticed a lot more prominent female scientists and engineers in mainland Northern Europe and Asia; and far more young women who take up tech/science based hobbies in NL/DE/DK/AT/FI/NO etc….

      0

      Voices

      10

      Replies

      Tags

      This topic has no tags

      Viewing 12 posts - 1 through 12 (of 12 total)
      • You must be logged in to reply to this topic.

      Forums Life Computers, Gadgets & Technology who can spot the flaw in this code?