[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: [CPROG] Mystisk parse error, eller ?



Hej Jakob,

Jakob Goldbach wrote:
> 
> Jeg får en parse error når jeg gcc'er følgende lille program stump.
> Men det virker fint med g++
> 
> Er der nogen der kan forklare mig hvorfor ?
> 
> #include<arpa/inet.h>
> 
> int main()
> {
>   struct sockaddr_in myaddr;
>   myaddr.sin_family = AF_INET;
> 
>   int a;
> 
>   return(0);
> }

Hmm....prøv dette:
#include<arpa/inet.h>

int main()
{
  struct sockaddr_in myaddr;
  int a;

  myaddr.sin_family = AF_INET;

  return(0);
}

...er det ikke noget med, at ANSI C foreskriver at alle variabler deklareres som
det første i ens kode? Hvorimod man i C++ kan deklarere dem midt i koden?
Mit eksempel kompilerer ihvertfald.

//Brix
-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Name:   Henrik Brix Andersen         Web: http://freakfoster.dhis.org
 E-mail: sslug@sslug  Get Linux: http://www.linux.org
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 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] *