Skip to content

How to avoid/reduce leaks by the compiler of the hidden code. #10

Open

Description

@nthiery

Upon compiler errors, the error messages often leak some of the hidden code. Typically, if the student forget the trailing ';' in his code, the error message will display the next line where the compiler detected the error.

This could be exploited by students to cheat, but that's a minor bother for now. What's more annoying is that it confuses students making them think that they need to introduce some of that code in their answer to fix it.

Could we insert some dummy intermediate code that would trigger the error, but not reveal confusing information?

int main() {
    int r
    {}
}
g++ bla.cc                                                                                                                                                                                                                      
bla.cc: In function ‘int main()’:
bla.cc:6:5: error: expected ‘,’ or ‘;’ before ‘{’ token
     {}
     ^

Or maybe we should just be using clang which tends to be better with error messages:

clang++ bla.cc                                                                                                                                                                                                              
bla.cc:3:10: error: expected ';' at end of declaration
    int r
         ^
         ;
1 error generated.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions