Coding Style Guidelines and Git/GitHub Workflow

About the actual programming of the game.

Re: Coding Style Guidelines and Git/GitHub Workflow

Postby mrout » Thu Aug 22, 2013 1:17 am

Andrew wrote:@mrout: I feel the header file should be strictly for declarations though..


Header file should be strictly for the interface. That should be mostly declarations, yes.
mrout
 
Posts: 731
Joined: Mon Aug 12, 2013 10:49 pm

Re: Coding Style Guidelines and Git/GitHub Workflow

Postby Andrew » Thu Aug 22, 2013 1:33 am

Then where would template and inline function definitions go if they aren't defined in the header files?

EDIT: Perhaps .ipp for both template and inline defs? That's what boost does.
IRC: |Andy|
Andrew
 
Posts: 110
Joined: Wed Aug 21, 2013 7:16 am
Location: Melbourne, Australia

Re: Coding Style Guidelines and Git/GitHub Workflow

Postby thomas9459 » Thu Aug 22, 2013 1:57 am

Andrew wrote:Then where would template and inline function definitions go if they aren't defined in the header files?

I believe (correct me if I'm wrong, mrout) that these should go after the class definition. The public part of the class is what defines the interface, and so anyone who want to look at the interface can just look there: they can simply ignore the other parts of the file, such as the private members, inline functions, and templates.
thomas9459
 
Posts: 101
Joined: Thu Aug 15, 2013 6:18 pm

Re: Coding Style Guidelines and Git/GitHub Workflow

Postby mrout » Thu Aug 22, 2013 1:49 pm

Andrew wrote:Then where would template and inline function definitions go if they aren't defined in the header files?

EDIT: Perhaps .ipp for both template and inline defs? That's what boost does.


Templates should go in header files, of course.
mrout
 
Posts: 731
Joined: Mon Aug 12, 2013 10:49 pm

Re: Coding Style Guidelines and Git/GitHub Workflow

Postby tecywiz121 » Wed Aug 28, 2013 6:15 pm

I'm sorry if this is a common C++ thing, but I was wondering how are we doing line wrapping?

Code: Select all
void a_really_long_name_function_blah(void* arg1, void* arg2, void* arg3,
    void* arg4)
{
    do_something_long_and_tedious_to_type_out(arg1, arg2, arg3, arg4,
        "here is another argument");
}

or

Code: Select all
void a_really_long_name_function_blah(void* arg1, void* arg2, void* arg3,
                                        void* arg4)
{
    do_something_long_and_tedious_to_type_out(arg1, arg2, arg3, arg4,
                                                "here is another argument");
}

or something else?
User avatar
tecywiz121
 
Posts: 36
Joined: Tue Aug 13, 2013 12:23 pm

Re: Coding Style Guidelines and Git/GitHub Workflow

Postby mrout » Thu Aug 29, 2013 12:16 am

tecywiz121 wrote:I'm sorry if this is a common C++ thing, but I was wondering how are we doing line wrapping?

Code: Select all
void a_really_long_name_function_blah(void* arg1, void* arg2, void* arg3,
    void* arg4)
{
    do_something_long_and_tedious_to_type_out(arg1, arg2, arg3, arg4,
        "here is another argument");
}

or

Code: Select all
void a_really_long_name_function_blah(void* arg1, void* arg2, void* arg3,
                                        void* arg4)
{
    do_something_long_and_tedious_to_type_out(arg1, arg2, arg3, arg4,
                                                "here is another argument");
}

or something else?



Code: Select all
void a_really_long_name_function_blah(void* arg1, void* arg2, void* arg3,
                                      void* arg4)
{
    do_something_long_and_tedious_to_type_out(arg1, arg2, arg3, arg4,
                                              "here is another argument");
}


Seems like the best way to do it, IMO.
mrout
 
Posts: 731
Joined: Mon Aug 12, 2013 10:49 pm

Re: Coding Style Guidelines and Git/GitHub Workflow

Postby tecywiz121 » Thu Aug 29, 2013 2:28 am

mrout wrote:
Code: Select all
void a_really_long_name_function_blah(void* arg1, void* arg2, void* arg3,
                                      void* arg4)
{
    do_something_long_and_tedious_to_type_out(arg1, arg2, arg3, arg4,
                                              "here is another argument");
}


Seems like the best way to do it, IMO.


So align with the first character after the open parenthesis?
User avatar
tecywiz121
 
Posts: 36
Joined: Tue Aug 13, 2013 12:23 pm

Re: Coding Style Guidelines and Git/GitHub Workflow

Postby mrout » Thu Aug 29, 2013 2:58 am

Yeah.
mrout
 
Posts: 731
Joined: Mon Aug 12, 2013 10:49 pm

Re: Coding Style Guidelines and Git/GitHub Workflow

Postby danix111 » Thu Aug 29, 2013 5:33 pm

Should we write functions in a way they can fit into one 80x24 screen?
User avatar
danix111
 
Posts: 61
Joined: Mon Aug 12, 2013 2:05 pm
Location: Gdynia, Poland

Re: Coding Style Guidelines and Git/GitHub Workflow

Postby Andrew » Thu Aug 29, 2013 5:36 pm

danix111 wrote:Should we write functions in a way they can fit into one 80x24 screen?


80 characters wide yes, no line limit though. However a very long function is indicative of code smell and you should investigate it and consider refactoring.
IRC: |Andy|
Andrew
 
Posts: 110
Joined: Wed Aug 21, 2013 7:16 am
Location: Melbourne, Australia

PreviousNext

Return to Code

Who is online

Users browsing this forum: No registered users and 1 guest

cron