It's UWAweek 21 (1st semester, week 12)

help3002

This forum is provided to promote discussion amongst students enrolled in CITS3002 Computer Networks.

Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message. How do I ask a good question?

Chris is away until 4th June. Dr Atif Mansoor is the unit's coordinator until then.
Displaying the 4 articles in this topic
Showing 4 of 449 articles.
Currently 2 other people reading this forum.


 UWA week 18 (1st semester, week 9) ↓
SVG not supported

Login to reply

👍?
helpful
2:52pm Mon 29th Apr, ANONYMOUS

Are there any restrictions on the compilers we should be using for the project, like in previous CITS units? Or do we have more freedom? For example, I am trying to use some header files that only work if I use the -std=gnu11 flag, which would still be under the C11 standard if I'm not mistaken. If we do have more freedom, does this mean that we should include a makefile to clarify what compilers we are using etc.?


SVG not supported

Login to reply

👍?
helpful
10:08am Tue 30th Apr, Christopher M.

ANONYMOUS wrote:
> Are there any restrictions on the compilers we should be using for the project, like in previous CITS units? Or do we have more freedom? > > For example, I am trying to use some header files that only work if I use the -std=gnu11 flag, which would still be under the C11 standard if I'm not mistaken. > > If we do have more freedom, does this mean that we should include a makefile to clarify what compilers we are using etc.?
Your question is not really about compilers, but about language standards or dialects: https://gcc.gnu.org/onlinedocs/gcc-13.2.0/gcc/Standards.html#C-Language If needing to use -std=gnu11, rather than just -std=c11 (gcc's current default is -std=gnu17) you must be selecting some additional features provided by GNU that may not, portably, be available in other environments. I'm interested to know what extra features your project requires, provided by -gnu11 but not standard C, (as some other teams may benefit from them, too) ?


SVG not supported

Login to reply

👍?
helpful
5:11pm Tue 30th Apr, ANONYMOUS

"Christopher McDonald" <ch*i*.*c*o*a*d@u*a*e*u*a*> wrote:
> Your question is not really about compilers, but about language standards or dialects: > https://gcc.gnu.org/onlinedocs/gcc-13.2.0/gcc/Standards.html#C-Language > > If needing to use -std=gnu11, rather than just -std=c11 (gcc's current default is -std=gnu17) you must be selecting some additional features provided by GNU that may not, portably, be available in other environments. > > I'm interested to know what extra features your project requires, provided by -gnu11 but not standard C, > (as some other teams may benefit from them, too) ?
Well I've been going through A Guide to Network Programming using Internet sockets, by Brian "Beej" Hall, as suggested in the Getting Started section of the Project, and to use the getaddrinfo() function it is necessary to include the <netdb.h> header file. After doing some research, "Adding std=c11 undefines __USE_POSIX macro which guards addrinfo struct in netdb.h" ( where addrinfo is a struct used by getaddrinfo() ). I'm not sure if it is unnecessary for me to be using getaddrinfo() in the first place, but I'm just curious to know whether we are meant to be sticking with the -std=c11 flag


SVG not supported

Login to reply

👍?
helpful
5:48am Thu 2nd May, Christopher M.

I've just been having another look at this, and the simplest solution appears to be to just use the default language dialects, without providing specific command-line arguments. On Linux, using a recent version of gcc (gcc --version, probably 13), the default dialect is gnu17 (which provides your getaddrinfo()). On macOS, using a recent version of clang (clang --version, probably 15), the default dialect is c11 (which also provides your getaddrinfo(), because Apple love to bundle everything in). So, the best approach on either platform seems to be to just run cc without any options for the language standard/dialect.

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  5:07AM Sep 06 2023
Privacy policy