GWatt's Profile User Rating: *****

Reputation: 282 Architect
Group:
Expert w/DIC++
Active Posts:
3,095 (0.93 per day)
Joined:
01-December 05
Profile Views:
41,106
Last Active:
User is offline Today, 01:00 PM
Currently:
Offline

Previous Fields

Country:
Who Cares
OS Preference:
Who Cares
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
525

Latest Visitors

Icon   GWatt has not set their status

Posts I've Made

  1. In Topic: sys/ucontext.h: No such file or directory

    Posted 25 Jan 2015

    https://www.gnu.org/...text_002eh.html
    Reading that seems to indicate that sys/ucontext.h is not present on windows systems.
  2. In Topic: What's your phone?

    Posted 12 Jan 2015

    I have a FFOS phone, but I should never have left my trusty and indestructable kyocera k9.
  3. In Topic: project euler problem 2 in c

    Posted 31 Dec 2014

    You need to get the even fibonacci numbers and the Nth fibonacci number is not necessarily even when N is even. You'll want to test the evenness of the output of fibo(number).
  4. In Topic: goto

    Posted 29 Nov 2014

    Since I enjoy beating dead horses and shouting into the wind, I'll state my opinion. I think gotos can be used well. The classical and canonical example is, of course, symmetric resource cleanup in C.
      if (x = acquire1()) ;
      else goto _end;
    
      if (y = acquire2()) ;
      else goto _cleanup_x;
      /* do actual stuff */
      cleanup2(y);
    _cleanup_x:
      cleanup1(x);
    _end:
      return retval;
    
    

    There are three ways around this using goto for this particular issue:

    • nested if/else around the acquisition and release codes to handle every possible code path.
    • putting your logic inside of a do-while(0) loop, setting a status code and breaking on failure, and using a switch with case fallthrough to handle cleanup.
    • splitting all acquisition into separate functions.

    1 gets messy fast.
    2 is basically just emulating gotos/labels. The difference is a matter of taste.
    3 (to me) is the most nuanced. If you can reuse the acquisition and logic, go for it. Otherwise, you're unnecessarily splitting up the code.

    I've also found an occasional use for goto in conjunction with loops. Consider building this prime sieve:
      /* primes: list of primes
         c: current count of primes
         n: total number of primes
      */
      for (int p = 3; c < n; p++) {
        for (int i = 0; i < c || primes[i] * primes[i] <= p; i++) {
          if (p % primes[i] == 0) goto _notprime;
        }
        primes[c++] = p;
    _notprime:;
      }
    
    

    The alternative is to maintain a flag. It's definitely a matter of taste, but I prefer the goto.
  5. In Topic: Linux -- What do you look for in a distro?

    Posted 5 Oct 2014

    I feel like expanding upon my earlier answer as it was pretty terse.
    In all honesty, most of the distros I've used feel the same. This makes sense as almost all of them have the gnu tools/libraries on top of the linux kernel. The differences mainly come from the package/update manager and how the distros organize the software. You can get most any desktop environment for any distro (not sure about Unity,) so there's no reason to pick one distro over the other simply because you like its default DE better.
    I previously mentioned Fedora, which I currently have on my workstation. What I didn't say is that I have a debian system in my home acting as a dns/dhcp server, a vps that's also running debian, the servers I manage for work are running a mix of ubuntu and debian, and finally the automotive grade PCs I program are running Wind River Linux. To me, all of those systems are basically identical. In the past I've used Gentoo, Slackware, and Arch and they also feel pretty much the same. (Gentoo feels the most different because you have to compile every single piece of software, and then go back and recompile half of them because you forgot to enable jpgs in your browser. Supposedly once you get Gentoo up and running it's great, but my experience was by the time you finished upgrading packages, new ones had already come out.)
    It doesn't matter that some things are organized differently or that the software versions can be wildly different. It's all just gnu on top of a linux kernel.
    I'm confident that pretty much any linux distribution you might choose will not be meaningfully different from any other.

My Information

Member Title:
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Years Programming:
10
Programming Languages:
C, C++, Objective C, arm assembly, Java, perl, scheme, python

Contact Information

E-mail:
Click here to e-mail me
Website URL:
Website URL  http://

Comments

Page 1 of 1
  1. Photo

    Biggie_smallz Icon

    04 Feb 2013 - 22:57
    Hello Gwatt can you please get back to me.. I need help with some scheme programming?
  2. Photo

    raghav.naganathan Icon

    17 Oct 2012 - 01:11
    Dude...before your reputation changes, I would like to tell you that it(256) is a perfect square :)
  3. Photo

    GWatt Icon

    27 Dec 2010 - 22:52
    @arob, I haven't used Java regularly in years. Most of what I do now is in C or scheme. However, there are several tutorials on this site and on others that should get you well on your way to learning Java.
  4. Photo

    arob Icon

    25 Dec 2010 - 23:31
    hey can u help to learn java .
  5. Photo

    GWatt Icon

    24 Jun 2010 - 19:59
    Pretty sure it has 4.
  6. Photo

    no2pencil Icon

    22 Jun 2010 - 20:06
    Where you plugged the phone, does it have four prongs or just two? I've had trouble using rotary phones on digital lines, other times it works flawlessly.
  7. Photo

    GWatt Icon

    30 May 2010 - 06:35
    Yeah, that did get removed in the upgrade. Oh and my rotary phone works fine. I use it in my dorm. It was simply our house lines that it doesn't like.
  8. Photo

    no2pencil Icon

    06 May 2010 - 01:13
    It's back! YAY!
    The phone I mean...
  9. Photo

    no2pencil Icon

    02 Mar 2010 - 03:47
    Hey man! Looks like after the upgrade you are no longer sporting the Rotary Phone...
Page 1 of 1