[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] Hvilket sprog



On Wed, 30 Jun 2004 00:18:14 +0200
Bo Simonsen <sslug@sslug> wrote:

> Jeg ved ikke hvilken C standard jeg benytter, jeg er dog ikke
> helt klar over hvilke ting der hører i hvilke standarder.
> 
> Jeg kunne dog tænke mig at
> 
> typedef struct test_
> {
> 	...
> } test;
> 
> test* testptr;
> 
> og 
> 
> struct test
> {
> 
> };
> 
> struct test* testptr;
> 
> Ligger i 2 forskellige standard specifikationer?


Nej nej da, uha. Hvor kan du tro det? ANSI versionen af 
"The C Programming Language" fortæller, at typedef er
medicinen mod den kringlede syntax i "complicated declarations".

Nogen anvender typedef fordi de synes 

  test* testptr;

ser pænere ud, især i fcn prototypes:

   int myfunc(struct test *tptr);

versus

   int myfunc(test tptr);

Men i eksempel 2 kan du ikke se, hvad test er. I anbefalet
programming style skulle der MINIMUM have stået

   int myfunc(FILE *tptr);

hvor FILE (eller TEST) antyder, at her er tale om en MACRO,
ellers bliver det lige så svært at debugge som C++, eller
Java, og hvor er vi så henne;-)


/donald

-- 
donald_j_axel donax snabela get2net.dk -- http://d-axel.dk/


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:43 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *