0

Im doing an assignment and the requirement instruction say "Your code should compile correctly (no warnings and errors) with no flags other -o. you should compile your code to a debug-able executable without producing any warnings or error messages. (Note that -O and -o are different flags.)"

So Im so confused what does the " no flags other -o " means. As far as I know, "flag is a general tool for rudimentary signalling and identification, especially in environments where communication is similarly challenging.", so does the requirement mean that we can't use any for loop ?

7
  • 1
    They are flags for the compiler, example gcc. You can see a whole list online Commented Sep 30, 2020 at 15:10
  • 3
    flags are options you give to the compiler, for instance -ofor gcc allows to indicate the target executable/binary/.... Note the statement is strange because request debugable executable and that generally means an option, for instance -g for gcc, so seems incompatible with only -o Commented Sep 30, 2020 at 15:11
  • 1
    "flag" in this case is a command line argument to the compiler call. So: don't use any other than what you need to specify the output file. Commented Sep 30, 2020 at 15:11
  • 1
    In this context, flags are command-line options, so the instructor is saying you can use the -o (dash oh) option to gcc, but no others. You can use any C language constructs you like inside your program. Commented Sep 30, 2020 at 15:12
  • 1
    do you confirm the compiler is gcc ? If yes I encourage you to compile with -Wall to enforce problem detection Commented Sep 30, 2020 at 15:14

2 Answers 2

3

No, the requirement is referring to command-line flags, ie options to the compiler. Eg, assuming gcc, gcc -o foo foo.c.

However, since the program is meant to be debuggable, the requirements are contradictory because creating a debuggable executable requires (for gcc) the -g flag.

Sign up to request clarification or add additional context in comments.

Comments

1

On many compilers, you can control the warning level with flags. The requirement here is to not use those flags, yet raise no warning.

Said differently, you are just asked to write neat and clean C code using no specific extension nor any semi valid constructs (code not conforming to the standard but accepted with warnings by a compiler)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.