Re: [Ilugc] [TIP] some C

2011-12-22 Thread Arun Khan
On Thu, Dec 22, 2011 at 10:52 AM, Sree  wrote:
> Hi,
>> $ gcc i.c
>>
>> will get you the result.
>
> Just adding to that, I've found that -Wall switch is very useful for
> finding silly errors that might creep in, so it makes sense to compile
> every C program with that switch on. And -g is useful if the compiled
> executable is to be debugged at a later stage.
>
> Both these switches are applicable to g++ too, and has the same meaning.

On a related tool, way back in my days as a developer, we used lint
(to remove all warnings and errors) before submitting our code to the
build queue (vt100 terminals connecting to the main frame over 1200
bps dial up lines)

A search for the same coughed up 'splint'  [1]  which looks very promising.

[1] http://www.splint.org/

-- Arun Khan
___
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc


Re: [Ilugc] [TIP] some C

2011-12-21 Thread Sree
Hi,
> $ gcc i.c
>
> will get you the result.

Just adding to that, I've found that -Wall switch is very useful for
finding silly errors that might creep in, so it makes sense to compile
every C program with that switch on. And -g is useful if the compiled
executable is to be debugged at a later stage.

Both these switches are applicable to g++ too, and has the same meaning.

Hope that helps :)


-- 
Regards,
Sree
___
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc


[Ilugc] [TIP] some C

2011-12-21 Thread Girish Venkatachalam
C programming is something everyone in India learns; at least whoever
has studied any of the core branches.

And many may not know how to compile and run a C program in a Linux box.

Here are some utter basics.

$ cat i.c
#include 
int
main() {
  printf("Hello World\n");
}

$ make i

or

$ gcc i.c

will get you the result.

The output file is either in i or a.out.

You can do a

$ ls -ltr

to figure out the latest file created.

Of course you should not compile C on UNIX without knowing some basic
UNIX commands.

A compiler like gcc only converts the source code of C into assembly.
You need a linker(ld) and an assember
 like gas to convert the assembly to machine code that is executed in the CPU.

Now C coding is about thinking a lot and not just getting your job
done without programming hassle.

In fact it is impossible to do C coding without design skills and no
high level design can be done without C coding
 experience.

In fact C is a language that demands an extremely high degree of
commitment, intellect and experience.

However most people seem to know many basic C programming concepts and
have experience running C code.

As to the IT industry I think any IT company in India depends on C
only as much as 20% or so.

Rest of the people get on with peripheral skills.

-Girish

-- 
G3 Tech
Networking appliance company
web: http://g3tech.in  mail: gir...@g3tech.in
___
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc