C Programming- Wrong forum, but where?: Generic IDE definitions?

This is a discussion on C Programming- Wrong forum, but where?: Generic IDE definitions? within the Tech Board forums, part of the Community Boards category; C code is fairly generic. I code in K&R style, using tab stops (vim defines a tab as 8 space ...

  1. #1
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065

    C Programming- Wrong forum, but where?: Generic IDE definitions?

    C code is fairly generic. I code in K&R style, using tab stops (vim defines a tab as 8 space boundaries). Many editors, however, set the tab stops at some (please, no religious discussions about styles) other number. Thinking back to long ago, I remember something about putting magic above the code that would define all that stuff for some editors (GNU Emacs, etc).

    Is there a generic set of parameters that one can put at the top of a C code file that would define the width of the line, the number of spaces/tab, etc?

    A quick Google search revealed nothing, but I just cannot seem to come up with good phrases to search (I'm really bad at it).

    Any information would be greatly appreciated.

    Mods -- If you move this message to an appropriate forum (maybe GD?) that's okay with me.

    Thanks,
    Andy

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,670
    Hmm, #pragma( tabstop, 4 ) didn't seem to work. In all seriousness, though, I have no idea.



    ITSA
    Socket Library!

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,453
    No, there is no universal fix it for tabs.

    Certain editors have particular styles of comment lines to convey the info, but unless you happen to also use the same editor (or one which understands the comment), it just doesn't work.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    Well, there should be. I hate it when, in a peer review, the folks say "I really think that your \ should be in a single line on the right." Maybe we should put this into the C 2019 standard .

    Thanks anyways,
    Andy

  5. #5
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    You can set tabs to whatever you want in vim (:set tabstop=4) but then you want to make the shiftwidth the same if you use >> (:set shiftwidth=4).

    Since this literally is a tab character (\t) that is interpreted by an editor, the only place this can really be an issue is in "cut and paste" situations where the tab will get turned into spaces. So it would be meaningless, I think, to attempt what you are talking about. A \t is a single byte in the source code file; it does not make any sense to say "make it X spaces instead", that's the realm of the viewer.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. General forum question - if in wrong forum...
    By ulillillia in forum A Brief History of Cprogramming.com
    Replies: 28
    Last Post: 05-14-2007, 05:00 AM
  2. Replies: 0
    Last Post: 06-26-2004, 05:59 PM
  3. ASP.net forum that supports Access
    By Grayson_Peddie in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 12-18-2003, 12:44 AM
  4. God
    By datainjector in forum A Brief History of Cprogramming.com
    Replies: 746
    Last Post: 12-22-2002, 11:01 AM
  5. Assembly forum
    By Garfield in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 11-18-2001, 07:03 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21