Re: newbie question

From: Emmanuel Delahaye (emdel_at_YOURBRAnoos.fr)
Date: 02/24/05


Date: Thu, 24 Feb 2005 03:29:42 +0100

some wrote on 24/02/05 :
>> BTW: It is considered better to use blanks (spaces) instead of tabs for
>> code posted to newsgroups.
> You mean I should leave some blanks before and after I post code or
> something else instead of using /// like I did. Can you please explain
> so that I can be careful in future.

No, it's something else. For example, on your code :

int main(int argc,char *argv[]) {
        int num;
^
| you have used the TAB character
here.

The problem is that some news readers clients (or is it some news
server, I don't know) strip the TAB and consequently, your code appears
like

int main(int argc,char *argv[]) {
int num;

which is not the expected way. To prevent that (and actually it solves
a lot of presentation elswere too), it is highly recommended to use
spaces instead of tabs:

[three spaces for a TAB]

int main(int argc,char *argv[]) {
   int num;

Most of the text editors used to write code have this function ("insert
n spaces when TAB is pressed"). Lurk at(for, in? please correct me) the
options.

-- 
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html
"Mal nommer les choses c'est ajouter du malheur au
monde." -- Albert Camus.


Relevant Pages

  • A source file de-tabifier for you
    ... *transform* one tab setting to another; thus, you can write your code with ... void do_line; ... int reset_on_com = FALSE; ... char **argv; ...
    (alt.comp.lang.learn.c-cpp)
  • Re: exercise 1-20 K&R
    ... of blanks to space to the next tab stop. ... int counter, c; ... character count for the current line, ... Tab stops are at the same character number (modulo TABSIZE) throughout ...
    (comp.lang.c)
  • Re: I dont quite understand this exercise...
    ... >ask the user/get and set a variable, say n, and replace all tabs with n ... A text file containing some tab characters. ... if N is 4 and the original file is: ... int jj = 0; ...
    (comp.lang.c)
  • [patch 1/14] s3c2412/s3c2413 support
    ... +s3c_lookup_cpu(unsigned long idcode,int alt) ... struct cpu_table *tab; ... int count; ...
    (Linux-Kernel)
  • Re: right padding
    ... int pow = 10; ... int num = 123; ... But then I would have to declare and use another buffer inside the ...
    (comp.lang.c)