[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c

C programming in 2011

Duncan Bayne

5/26/2011 3:28:00 AM

Hi All,

Many moons ago I cut C code for a living, primarily while maintaining
a POP3 server that supported a wide range of OSs (Linux, *BSD, HPUX,
VMS ...).

I'm planning to polish the rust off my C skills and learn a bit about
language implementation by coding a simple FORTH in C.

But I'm wondering how (or whether?) have things changed in the C world
since 2000. When I think C, I think ...

1. comp.lang.c
2. ANSI C wherever possible (but C89 as C99 isn't that widely
supported)
3. `gcc -Wall -ansi -pedantic` in lieu of static analysis tools
4. Emacs
5. Ctags
6. Autoconf + make (and see point 2 for VMS, HP-UX etc. goodness)

Can anyone who's been writing in C for the past eleven years let me
know what (if anything ;-) ) has changed over the years?

(In other news, holy crap, I've been doing this for more than a
decade).

--
Duncan Bayne
ph: +61 420 817 082 | web: http://www.fluidscape....| skype:
duncan_bayne
157 Answers

Shao Miller

5/26/2011 3:33:00 AM

0

On 5/25/2011 10:27 PM, Duncan Bayne wrote:
> ...When I think C, I think ...
>
> ...
> 2. ANSI C wherever possible (but C89 as C99 isn't that widely
> supported)
> 3. `gcc -Wall -ansi -pedantic` in lieu of static analysis tools
> ...

Agreed. :)

ram

5/26/2011 3:51:00 AM

0

Duncan Bayne <dhgbayne@gmail.com> writes:
>1. comp.lang.c

Usenet is dying. (Some people say.) Try Twitter?

(Oh, I see you are not using a real newsgroup client,
but Google Groups, so you already support the Web!)

>2. ANSI C wherever possible (but C89 as C99 isn't that widely
>supported)

ISO C.

>3. `gcc -Wall -ansi -pedantic` in lieu of static analysis tools

-std=c99 -pedantic -Wall -Wno-parentheses -Wconversion
(This reflects my personal choice only.)

>4. Emacs

Gesundheit! - Real C programms use vi.
Just kidding.

>5. Ctags

valgrind, lint, indent, cweb (cweave/ctangle),
subversion/git, cxref, cflow, gprof, cstyle, cdecl ...

>6. Autoconf + make (and see point 2 for VMS, HP-UX etc. goodness)

Can this be used on, say, Microsoft® Windows? (I know that
make is available for Windows. I referred to Autoconf.)

Duncan Bayne

5/26/2011 3:59:00 AM

0

>   Can this be used on, say, Microsoft Windows? (I know that
>   make is available for Windows. I referred to Autoconf.)

Only via Cygwin (and then, you'd better bundle shtool). But it works
most everywhere else ... and where it doesn't (e.g. Windows) there's
always hand-crafted Makefiles. At least that's the way I used to do
it back in the day.

--
Duncan Bayne
ph: +61 420 817 082 | web: http://www.fluidscape....| skype:
duncan_bayne

Duncan Bayne

5/26/2011 4:07:00 AM

0

On May 26, 1:58 pm, Duncan Bayne <dhgba...@gmail.com> wrote:
> >   Can this be used on, say, Microsoft Windows? (I know that
> >   make is available for Windows. I referred to Autoconf.)
>
> Only via Cygwin (and then, you'd better bundle shtool).  But it works
> most everywhere else ... and where it doesn't (e.g. Windows) there's
> always hand-crafted Makefiles.  At least that's the way I used to do
> it back in the day.

In fact, thinking back, I think the way we did it for the
aforementioned POP3 server was to have a Visual C++ 6.0 solution for
building on Windows, Autoconf for most other OSs, plus maybe custom
Makefiles? I think that most of us used Windows as a dev platform,
some (including me) used Linux, and one chap some sort of BSD.

As you can probably tell, my memory of that project is a little
fuzzy :-)

--
Duncan Bayne
ph: +61 420 817 082 | web: http://www.fluidscape....| skype:
duncan_bayne

Shao Miller

5/26/2011 4:25:00 AM

0

On 5/25/2011 11:06 PM, Duncan Bayne wrote:
> In fact, thinking back, I think the way we did it for the
> aforementioned POP3 server was to have a Visual C++ 6.0 solution for
> building on Windows, Autoconf for most other OSs, plus maybe custom
> Makefiles? I think that most of us used Windows as a dev platform,
> some (including me) used Linux, and one chap some sort of BSD.
>
> As you can probably tell, my memory of that project is a little
> fuzzy :-)

I seem to recall TinyMUX having a similar strategy. It might bring back
some memories for you, should you choose to indulge.

Angel

5/26/2011 7:52:00 AM

0

On 2011-05-26, Duncan Bayne <dhgbayne@gmail.com> wrote:
> Hi All,
>
> Many moons ago I cut C code for a living, primarily while maintaining
> a POP3 server that supported a wide range of OSs (Linux, *BSD, HPUX,
> VMS ...).

Oh, what was the name of that server? I'd like to know...

> I'm planning to polish the rust off my C skills and learn a bit about
> language implementation by coding a simple FORTH in C.
>
> But I'm wondering how (or whether?) have things changed in the C world
> since 2000. When I think C, I think ...

I've been trying to shake the rust off of me for some time, last time I
did any real serious programming was back in college about 10 years ago.

> 1. comp.lang.c

I'm new here myself, joined a few months ago. Seems like a friendly and
helpful group most of the time.

Which reminds me, I should thank everyone who answered my query here.
Making my code more portable didn't only make my program work on Sparc
and PPC, it also made the coding as a whole a heck of a lot easier.

> 2. ANSI C wherever possible (but C89 as C99 isn't that widely
> supported)

I tend to stick to C99 as it has many good features that I missed in old
C. It really is an improvement IMHO.

> 3. `gcc -Wall -ansi -pedantic` in lieu of static analysis tools

I tend to use 'gcc -std=gnu99 -Wall -Werror' as I mostly develop for
Linux/GNU, but I avoid gcc-specific constructs where I can.

> 4. Emacs

Vi IMproved for me, but whatever works. The Linux kernel folks seem not
too fond of emacs' default layout for C though, just saying...

> 5. Ctags

Good stuff. ^^

> 6. Autoconf + make (and see point 2 for VMS, HP-UX etc. goodness)

I have to figure out autoconf someday...


--
"C provides a programmer with more than enough rope to hang himself.
C++ provides a firing squad, blindfold and last cigarette."
- seen in comp.lang.c

Chris H

5/26/2011 10:13:00 AM

0

In message <C-20110526054222@ram.dialup.fu-berlin.de>, Stefan Ram
<ram@zedat.fu-berlin.de> writes
>Duncan Bayne <dhgbayne@gmail.com> writes:
>>1. comp.lang.c
>
> Usenet is dying. (Some people say.)

Sadly true.

>Try Twitter?

Orrible :-(

>
> (Oh, I see you are not using a real newsgroup client,
> but Google Groups, so you already support the Web!)
>
>>2. ANSI C wherever possible (but C89 as C99 isn't that widely
>>supported)
>
> ISO C.

ISO-C95 NOT C99
However ISO C 12 may be an improvement.

>>3. `gcc -Wall -ansi -pedantic` in lieu of static analysis tools

No. Use a proper static analyser.

>>4. Emacs

Editor etc is personal preference.


--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/



Chris H

5/26/2011 10:15:00 AM

0

In message <slrnits1k7.2tt.angel+news@pearlgates.net>, Angel
<angel+news@spamcop.net> writes
>> 2. ANSI C wherever possible (but C89 as C99 isn't that widely
>> supported)
>
>I tend to stick to C99 as it has many good features that I missed in old
>C. It really is an improvement IMHO.

Good luck.... most compilers do NOT support C99. Those that *claim* to
only support parts of it.

Most areas of the industry tend to avoid C99 all together.





--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/



Duncan Bayne

5/26/2011 10:41:00 AM

0

> Oh, what was the name of that server? I'd like to know...

DPOP.

> Vi IMproved for me, but whatever works. The Linux kernel folks seem not
> too fond of emacs' default layout for C though, just saying...

The only oddity I've noticed is indenting in loops, like:

while (foo)
{
bar();
}

> I have to figure out autoconf someday...

Let me know when you do ;-) I've figured out just enough to do what I
need, & nothing more :-)

--
Duncan Bayne
ph: +61 420 817 082 | web: http://www.fluidscape....| skype:
duncan_bayne

--
undefined

James Kuyper

5/26/2011 10:53:00 AM

0

On 05/26/2011 06:15 AM, Chris H wrote:
> In message <slrnits1k7.2tt.angel+news@pearlgates.net>, Angel
> <angel+news@spamcop.net> writes
>>> 2. ANSI C wherever possible (but C89 as C99 isn't that widely
>>> supported)
>>
>> I tend to stick to C99 as it has many good features that I missed in old
>> C. It really is an improvement IMHO.
>
> Good luck.... most compilers do NOT support C99. Those that *claim* to
> only support parts of it.

It's true that very few compilers fully support C99, But it's also true
that compilers which support most of the new features of C99 are quite
commonplace nowadays.

--
James Kuyper