Talk:Indent style

I like to pull returns and break to the left, so that the flow break is very visible, but this probably a brainchild of mine that never caught on.


Has anyone considered merging this article with the material under indentation? I think they are both children of the Jargon File entry on the same. --Ardonik 00:46, Jul 16, 2004 (UTC)

I would argue to keep them separate. Indentation has a seperate meaning to that in computing. The text in this article is a bit more refined, IMO, as well, so perhaps merge the programming stuff in Indentation here. Dysprosia 02:08, 16 Jul 2004 (UTC)
What if this page was moved to Programming Styles, and the examples fleshed out to, maybe, 7 lines to show how variables are named and where spaces go?
I suggest this because a "Programming Styles" page would be useful, but if it existed it would duplicate the info on this page. So, if I get the time some night, any objections to me turning this into a full blown Programming Styles article? Gronky 23:11, 29 Jul 2004 (UTC)
What other styles are there? As this page says, there are other indenting or whatever styles used by people, which come and go. If you're talking about variable naming and spacing or whatever, we have articles on Hungarian notation and Camel case and naming convention or whatever, so I think it may just duplicate those articles. Dysprosia 03:11, 30 Jul 2004 (UTC)

The pros and cons for GNU style looked like filler, so I'm guessing no one was madly attached to them. While 2+2 == 4, GNU style won't produce any more line overflow than the other styles. As a GNU styler, I know the con I've written is true. Gronky 23:43, 28 Jul 2004 (UTC)



I added a note to point out that indentation isn't ALWAYS just a matter of readability. A number of programming languages use the indentation to DETERMINE the structure of the program - rather than it merely being a matter of readability. Occam and Python came to mind - if anyone knows of others - they should probably be added.

Older Fortran and Cobol compilers had annoying restrictions on indentation. --DavidCary 18:02, 20 Apr 2005 (UTC)

There's Haskell, too. Fredrik | talk 18:21, 20 Apr 2005 (UTC)

It might also be good to add one or two examples in other languages. Indentation of Pascal using anything other than BSD style would look pretty nasty. How do people indent LISP?



if (x < 0) {
    printf("Negative");
    negative(x);
} else {
    printf("Positive");
    positive(x);
}

K&R style


if(x<0){
    printf("Negative");
    negative(x);
}else{
    printf("Positive");
    positive(x);
}

Another common style that squeezes out even more spaces. Is there a name for this style? Other than Avoiding Guido's pet peeves (http://www.python.org/doc/essays/styleguide.html)? --DavidCary 18:02, 20 Apr 2005 (UTC)

It actually sort of looks more like Python than many other styles... Fredrik | talk 18:21, 20 Apr 2005 (UTC)

NPV

Can someone have a look at the writeups for the styles to make sure they're NPV? The article seems to favor BSD/Allman by using "proponents of this style" with the other two. I'm not sure this is appropriate, and looks like a simple fix for someone familiar with the topic. --Steven Fisher 06:53, 29 Apr 2005 (UTC)

Okay, I decided to give it a go myself. Please have a look and see if I've screwed anything up. --Steven Fisher 03:26, 7 May 2005 (UTC)

Another format I use.

There is a format I sometimes use which I find very readable:

   if (x < 0) {
       printf("Negative");
       negative(x);
       }
   else {
       printf("Positive");
       positive(x);
       }

This is eccanomic with lines so that a page of code scans well. I also think it shows the content of the section very clearly, since all lines in the section without exception are intented by the same amount.

ben@clewett.org.uk

Fine, but due to Wikipedia:No original research, we don't include people's own personal styles. Dysprosia 12:34, 17 Jun 2005 (UTC)
Navigation

  • Art and Cultures
    • Art (https://academickids.com/encyclopedia/index.php/Art)
    • Architecture (https://academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (https://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (https://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)

Information

  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Toolbox
Personal tools