Page 6 of 30 FirstFirst ... 4567816 ... LastLast
Results 51 to 60 of 297

Thread: "Hello Ubuntu" in every programming language

  1. #51
    Join Date
    Dec 2005
    Beans
    527
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: "Hello Ubuntu" in every programming language

    Quote Originally Posted by ButteBlues View Post
    You shall be obligatorily lynched for using hard tabs in the Ruby and Python code instead of 2 and 4 spaces respectively.
    Ruby is supposed to have 2 space tabs? Odd

  2. #52
    Join Date
    Jun 2006
    Location
    ~wfarr
    Beans
    409

    Re: "Hello Ubuntu" in every programming language

    Quote Originally Posted by Note360 View Post
    Ruby is supposed to have 2 space tabs? Odd
    Two spaces - yes. Not "two space tabs"; they're not tabs at all.

  3. #53
    Join Date
    Dec 2005
    Beans
    527
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: "Hello Ubuntu" in every programming language

    Quote Originally Posted by ButteBlues View Post
    Two spaces - yes. Not "two space tabs"; they're not tabs at all.

    WHAT NO TABS. That royally sucks, now i have to mess with my emacs settings...

  4. #54
    Join Date
    Jun 2006
    Location
    ~wfarr
    Beans
    409

    Re: "Hello Ubuntu" in every programming language

    Quote Originally Posted by Note360 View Post
    WHAT NO TABS. That royally sucks, now i have to mess with my emacs settings...
    Just add this to your .emacs:

    Code:
    (setq-default indent-tabs-mode nil)
    From there on out, it'll be smart about detecting spacings for code. (IE. hitting a tab while editing Python will indent properly for Python, same for Ruby, etc.)

  5. #55
    Join Date
    Jan 2007
    Location
    the third world
    Beans
    Hidden!

    Re: "Hello Ubuntu" in every programming language

    Quote Originally Posted by ButteBlues View Post
    You shall be obligatorily lynched for using hard tabs in the Ruby and Python code instead of 2 and 4 spaces respectively.
    I am more of a C programmer than anything else, so all programs written by me in other languages will bow to my indent rule of an 8 character tab width.
    I also limit lines to 80 characters, but didn't particulary care for enforcing that in the python and ruby gtk examples.
    IESVS FELLAT IN INFERNVM

  6. #56
    Join Date
    Oct 2006
    Location
    Austin, Texas
    Beans
    2,715

    Re: "Hello Ubuntu" in every programming language

    Quote Originally Posted by runningwithscissors View Post
    I am more of a C programmer than anything else, so all programs written by me in other languages will bow to my indent rule of an 8 character tab width.
    I also limit lines to 80 characters, but didn't particulary care for enforcing that in the python and ruby gtk examples.
    I'm a C programmer too, and also I have a 80 char line rule... But I only use 4 space tabs (replaced tabs, not real tabs... I hate real tabs).

    How can you get anything done with 8 space tabs and only 80 chars a line?

  7. #57
    Join Date
    Jan 2007
    Location
    the third world
    Beans
    Hidden!

    Re: "Hello Ubuntu" in every programming language

    Quote Originally Posted by Wybiral View Post
    I'm a C programmer too, and also I have a 80 char line rule... But I only use 4 space tabs (replaced tabs, not real tabs... I hate real tabs).

    How can you get anything done with 8 space tabs and only 80 chars a line?
    I just find the 8 char indent more readable, that's all. I tend to use a few helper functions (maybe inlined) if it starts to drift too far to the right. I haven't had too many problems except in the case of complicated data structures, like: state->list[state->selected].blah->type.... and so on, where a line-break looks a bit ugly.
    But it works alright most of the time.
    Last edited by runningwithscissors; July 16th, 2007 at 10:24 AM.
    IESVS FELLAT IN INFERNVM

  8. #58
    Join Date
    Oct 2006
    Location
    Austin, Texas
    Beans
    2,715

    Re: "Hello Ubuntu" in every programming language

    Quote Originally Posted by runningwithscissors View Post
    I just find the 8 char indent more readable, that's all. I tend to use a few helper functions (maybe inlined) if it starts to drift too far to the right. I haven't had too many problems except in the case of complicated data structures, like: state->list[state->selected].blah->type.... and so on, where a line-break looks a bit ugly.
    But it works alright most of the time.
    My main problem is when I have to use a pre-existing library like SDL or OpenGL. Some of the functions have HUGE parameter lists and when they're called inside of a condition in a loop... Well, it gets out of control. I like to stay within the 80 char lines, but I often have to make exceptions (if it's a couple of characters out I won't wrap it).

    Here's an SDL function for example:
    Code:
    SDL_Surface *SDL_CreateRGBSurfaceFrom  (void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
    Crazy...

  9. #59
    Join Date
    Dec 2006
    Location
    Australia
    Beans
    1,097
    Distro
    Xubuntu 15.10 Wily Werewolf

    Re: "Hello Ubuntu" in every programming language

    Could we please get back on-topic?

    I've created a new thread/poll about tabbing/spacing here: http://ubuntuforums.org/showthread.php?t=502561
    Last edited by samjh; July 17th, 2007 at 01:07 AM.

  10. #60
    Join Date
    Oct 2006
    Location
    Austin, Texas
    Beans
    2,715

    Re: "Hello Ubuntu" in every programming language

    Quote Originally Posted by samjh View Post
    Couldn't you rearrange that to something like:
    Code:
    SDL_Surface *SDL_CreateRGBSurfaceFrom  (
        void *pixels, int width, int height, int depth, int pitch,
        Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask
    );
    ?
    Yeah, but sometimes that starts to look even worse! Especially if you're using lots of structures and indent it to 8 characters, lol.

    That's why I stick with short, simple naming conventions, modularize everything, and only use 4 space tabs.

    But like I said, I will let it go two or three characters over... It's silly to use another line and indent AGAIN just to fit a few extra characters in.

Page 6 of 30 FirstFirst ... 4567816 ... LastLast

Bookmarks

Posting Permissions

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