| Author | Message | 
	
		| Cyan~Fire I'll count you!
 
  
 
 Age:37
 Gender:
  Joined: Jul 14 2003
 Posts: 4608
 Location: A Dream
 Offline
 
 | 
			
			  | 
				
					|  Posted: Wed Oct 27, 2004 5:39 pm   Post maybe stupid    Post subject: |  |   |  |  
				| 
 |  
				| Well duh! It doesn't work in C, so it must be bad! _________________
 This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
 Wise men STILL seek Him.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| CypherJF I gargle nitroglycerin
 
  
 Gender:
  Joined: Aug 14 2003
 Posts: 2582
 Location: USA
 Offline
 
 | 
			
			  | 
				
					|  Posted: Wed Oct 27, 2004 5:42 pm   Post maybe stupid    Post subject: |  |   |  |  
				| 
 |  
				| so cry me a river... 
 
  _________________
 Performance is often the art of cheating carefully. - James Gosling
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Mr Ekted Movie Geek
 
  
 Gender:
  Joined: Feb 09 2004
 Posts: 1379
 Offline
 
 | 
			
			  | 
				
					|  Posted: Thu Oct 28, 2004 2:24 am   Post maybe stupid    Post subject: |  |   |  |  
				| 
 |  
				| iostream is about 27 levels of function calls away from the operating system. And do you know what it uses? printf! _________________
 4,691 irradiated haggis!
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Dr Brain Flip-flopping like a wind surfer
 
  
 Age:39
 Gender:
  Joined: Dec 01 2002
 Posts: 3502
 Location: Hyperspace
 Offline
 
 | 
			
			  | 
				
					|  Posted: Thu Oct 28, 2004 7:09 am   Post maybe stupid    Post subject: |  |   |  |  
				| 
 |  
				| And the OS is probably another 50 function calls away from the assembly. 
 Iostream makes it easier for programmers to develop programs. That's why it's there. Not so that it can print to the console with blindingly fast speed, because, after all, no one really cares how long it takes.
 _________________
 Hyperspace Owner
 
 Smong> so long as 99% deaths feel lame it will always be hyperspace to me
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| lp_street_soldier Thing 1
 
  
 Age:34
 Gender:
  Joined: Apr 24 2004
 Posts: 352
 Location: Britain
 Offline
 
 | 
			
			  | 
				
					|  Posted: Thu Oct 28, 2004 7:53 am   Post maybe stupid    Post subject: |  |   |  |  
				| 
 |  
				| Bleh <_< |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Mr Ekted Movie Geek
 
  
 Gender:
  Joined: Feb 09 2004
 Posts: 1379
 Offline
 
 | 
			
			  | 
				
					|  Posted: Thu Oct 28, 2004 8:07 am   Post maybe stupid    Post subject: |  |   |  |  
				| 
 |  
				|  	  | Dr Brain wrote: |  	  | And the OS is probably another 50 function calls away from the assembly. 
 Iostream makes it easier for programmers to develop programs. That's why it's there. Not so that it can print to the console with blindingly fast speed, because, after all, no one really cares how long it takes.
 | 
 
 You must work for Microsoft!
  |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| SuSE Me measures good
 
  
 Joined: Dec 02 2002
 Posts: 2307
 Offline
 
 | 
			
			  | 
				
					|  Posted: Thu Oct 28, 2004 8:47 am   Post maybe stupid    Post subject: |  |   |  |  
				| 
 |  
				| Anybody read "The C Programming Language" or "The C++ Programming Language"?  Comments? |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| k0zy Server Help Squatter
 
  
 Gender:
  Joined: Jan 11 2003
 Posts: 571
 Location: Germany
 Offline
 
 | 
			
			  | 
				
					|  Posted: Thu Oct 28, 2004 10:17 am   Post maybe stupid    Post subject: |  |   |  |  
				| 
 |  
				|  	  | Mr Ekted wrote: |  	  | I never use scanf() in any program. And if you are going to use iostream, you might as well prgram in VB. | 
 
 What do you use?
 You do the same as MGB?
 
 
  	  | Mine GO BOOM wrote: |  	  | I still do gets() -> atoi() | 
 
 EDIT: Here's a program I had to code for my programming class.
 I began studying Computer Scince a few month ago. (I knew how to code C before)
 The program solves the equation a1*x + a0 = 0
 
 	| /*
Author: Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole....
 Martikelnummer: xxxxxx
 Aufgabe 10
 ----
 Programm liest aj der Gleichung a1*x + a0 = 0 ein, und berechnet x
 */
 
 #include <stdio.h>
 
 int main(void) {
 
 double a0=0;   // erster Faktor der Gleichung
 double a1=0;   // zweiter Faktor der Gleichung
 double x=0;      // x das berechnet werden soll
 
 puts("a1*x + a0 = 0");
 puts("a1 und a0 eingeben:");
 scanf("%lf %lf",&a1,&a0);      // Zahlen vom Typ double einlesen
 
 /*
 Lösung der Gleichung:
 a1 * x + a0 = 0
 a1 * x = -a0
 x = -a0/a1
 */
 
 // Keine Lösung für a1=0, weil man nicht du 0 teilen darf, also Fehler abfangen.
 if (a1 != 0) {
 x = -a0/a1;
 printf("x= %.2lf\n",x);
 } else {
 puts("Keine Lösung der Gleichung für a1 = 0");
 }
 
 return 0;
 }
 | 
 
 Any comments on the coding style and the way I solved the problem, Ekted?
 I'd like to know if an axperienced coder like you tells me the same things as my lecturer, because I doubt what he says sometimes.
 
 Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole....
 _________________
 It's a shark! Oh my god! Unbelievable!
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| -Smong- Guest
 
 
 Offline
 
 | 
			
			  | 
				
					|  Posted: Thu Oct 28, 2004 2:52 pm   Post maybe stupid    Post subject: |  |   |  |  
				| 
 |  
				| I prefer to put opening curly brackets on their own line as you can then find code blocks easier. Although when I first started I only had 160x160 screen and 4k file size limit so I was trying to cram as much as posible onto each line. 
 Also when passing parameters and such I put a space after the comma so it reads well.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Mr Ekted Movie Geek
 
  
 Gender:
  Joined: Feb 09 2004
 Posts: 1379
 Offline
 
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Mr Ekted Movie Geek
 
  
 Gender:
  Joined: Feb 09 2004
 Posts: 1379
 Offline
 
 | 
			
			  | 
				
					|  Posted: Thu Oct 28, 2004 5:53 pm   Post maybe stupid    Post subject: |  |   |  |  
				| 
 |  
				| Here's a picture I made showing most of my style issues... 
 
  |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| CypherJF I gargle nitroglycerin
 
  
 Gender:
  Joined: Aug 14 2003
 Posts: 2582
 Location: USA
 Offline
 
 | 
			
			  | 
				
					|  Posted: Thu Oct 28, 2004 6:38 pm   Post maybe stupid    Post subject: |  |   |  |  
				| 
 |  
				| style natzi  jk... I think it's good advice to have a consistent clean programming style. |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Mine GO BOOM Hunch Hunch
 What What
 
  
 
 Age:42
 Gender:
  Joined: Aug 01 2002
 Posts: 3615
 Location: Las Vegas
 Offline
 
 | 
			
			  | 
				
					|  Posted: Fri Oct 29, 2004 1:07 am   Post maybe stupid    Post subject: |  |   |  |  
				| 
 |  
				| I like the function's to be indented. Other than that, its pretty much the same. I have the {}'s indented or not depending on whatever editor I use at the time sets up as the default. 
 I prefer /* */ for large comment blocks over //'s. And when I do, I always have each new line started with a *, and all the *'s line up vertically.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Onlyone Newbie
 
 
 Joined: Jul 26 2004
 Posts: 13
 Offline
 
 | 
			
			  | 
				
					|  Posted: Fri Oct 29, 2004 3:14 am   Post maybe stupid    Post subject: |  |   |  |  
				| 
 |  
				| Dang Ekted... i thought i was a neat freak  |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Solo Ace Yeah, I'm in touch with reality...we correspond from time to time.
 
  
 Age:38
 Gender:
  Joined: Feb 06 2004
 Posts: 2583
 Location: The Netherlands
 Offline
 
 | 
			
			  | 
				
					|  Posted: Fri Oct 29, 2004 5:35 am   Post maybe stupid    Post subject: Astyle |  |   |  |  
				| 
 |  
				| I dislike a few things in Ekted's style, although most of it is the same as mine.   
 Sourceforge has some project called "astyle", I hate how it was written but it works, anyway, it can restyle source code into a bunch of styles.
 Could be interesting for "style nazis".
  |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Cyan~Fire I'll count you!
 
  
 
 Age:37
 Gender:
  Joined: Jul 14 2003
 Posts: 4608
 Location: A Dream
 Offline
 
 | 
			
			  | 
				
					|  Posted: Fri Oct 29, 2004 6:25 am   Post maybe stupid    Post subject: |  |   |  |  
				| 
 |  
				| I basically have the same style as MGB: Ekted's style but with indented functions. Actually, why do you not indent your functions, Ekted? |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Mr Ekted Movie Geek
 
  
 Gender:
  Joined: Feb 09 2004
 Posts: 1379
 Offline
 
 | 
			
			  | 
				
					|  Posted: Fri Oct 29, 2004 2:13 pm   Post maybe stupid    Post subject: |  |   |  |  
				| 
 |  
				| I don't indent functions because it's just extra work, wasted space, at the lowest level. Since function are always delimited by green comments, it's easy to see where they begin and end. It's not important to me that everyone use my style. They just need to be consistent within their own style, and be relatively clean. When people code using their own style, it's easier for them to code with fewer mistakes. I also believe in 1-file 1-coder methodology. I do not share code on projects. If someone takes over file(s) of yours, they own it and can format it how they wish. |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Dr Brain Flip-flopping like a wind surfer
 
  
 Age:39
 Gender:
  Joined: Dec 01 2002
 Posts: 3502
 Location: Hyperspace
 Offline
 
 | 
			
			  | 
				
					|  Posted: Fri Oct 29, 2004 3:04 pm   Post maybe stupid    Post subject: |  |   |  |  
				| 
 |  
				| That's bacicly how I feel about peoeple's styles, with a few exceptions. When I code for ASSS, I try to follow the ASSS coding style. As it's not all that different from the way I code, this wasn't a big strech. Though I've recently given up this habit, I do feel that people should make a small effort to keep files in a public project similar to each other. |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Mr Ekted Movie Geek
 
  
 Gender:
  Joined: Feb 09 2004
 Posts: 1379
 Offline
 
 | 
			
			  | 
				
					|  Posted: Fri Oct 29, 2004 4:16 pm   Post maybe stupid    Post subject: |  |   |  |  
				| 
 |  
				| I found the ASSS source files that I saw to be unreadable. grel and I are on opposite ends of the spectrum for code design, coding style, and open source issues, so it's best that we don't work together anyways. |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  |