Search found 27 matches

by CrawlCycle
November 27th, 2020, 4:41 pm
Forum: Coder’s Corner
Topic: Draft of the plan to refactor the preprocessor
Replies: 8
Views: 8009

Re: Draft of the plan to refactor the preprocessor

Thanks a lot for reading the long plan and providing feedback. I agree that the shim is unnecessary since the old and new preprocessor have the same public API and only a few source files #include the preprocessor. There is no need for a compatibility layer in this case. I have deleted the steps reg...
by CrawlCycle
November 27th, 2020, 5:06 am
Forum: Coder’s Corner
Topic: Draft of the plan to refactor the preprocessor
Replies: 8
Views: 8009

Re: Draft of the plan to refactor the preprocessor

Since readability/understandability is a concern, is there a "coding style guide" that we would like to use to "proofread" the code? Like such Using an automatic formatter can be a good idea. We are currently using clang-format . The .clang-format file of Wesnoth is at here . Ot...
by CrawlCycle
November 26th, 2020, 6:55 pm
Forum: Coder’s Corner
Topic: Draft of the plan to refactor the preprocessor
Replies: 8
Views: 8009

Draft of the plan to refactor the preprocessor

Background Motivation The preprocessor is a small header and a source file (1801 lines) that contains a large class (1402 lines) with a large method (607 lines). The internal workings of the preprocessor is unclear at a quick glance. The output of the preprocessor is in a format that is incompletel...
by CrawlCycle
November 26th, 2020, 8:12 am
Forum: Coder’s Corner
Topic: Wording and style for Doxygen documentation
Replies: 22
Views: 14632

Re: Wording and style for Doxygen documentation

Two methods to describe the time complexity of an operation. Hint the speed of the operation with another set of verbs in the brief description: For example, create vs fabricate, get vs retrieve Document the time complexity as a new section in the Doxygen block. I think option 2 is better. Benchmark...
by CrawlCycle
November 26th, 2020, 6:47 am
Forum: Coder’s Corner
Topic: Wording and style for Doxygen documentation
Replies: 22
Views: 14632

Re: Wording and style for Doxygen documentation

Even better:
The "list of children" is an implementation detail.

Code: Select all

/** Get the first child node with the key. ... */
/** Get a child node with the key. ... */
/**
 * Append an empty child node with @p key. The new child will be the last
 * one in the list of children with the @p key.
 */
by CrawlCycle
November 25th, 2020, 9:04 pm
Forum: Coder’s Corner
Topic: Miscellaneous
Replies: 6
Views: 8011

Re: Miscellaneous

I think I will settle with this one:

Code: Select all

// Work around a Boost<1.67 bug fixed in 1.67: Include test_case.hpp after
// unit_tests.hpp. https://svn.boost.org/trac10/ticket/13387
by CrawlCycle
November 25th, 2020, 7:08 pm
Forum: Coder’s Corner
Topic: Miscellaneous
Replies: 6
Views: 8011

Re: Miscellaneous

Workaround for Boost>=1.67 bug would represent a bug that has not been fixed since version 1.67. Is the grammar of the comment correct? I think it should have an extra "a": Workaround for a Boost>=1.67 bug . But sometimes people might forget to add the "a". In that case, searchi...
by CrawlCycle
November 25th, 2020, 4:04 pm
Forum: Coder’s Corner
Topic: Miscellaneous
Replies: 6
Views: 8011

Miscellaneous

Commenting a workaround for an external dependency There are 13 usages of the noun "workaround" and 8 usages of the verb "work around" in the .cpp and .hpp files. /** * Default constructor, defined out of line to work around a warning in * gcc 4.5.2 */ /* Workaround for an SDL b...
by CrawlCycle
November 25th, 2020, 5:34 am
Forum: Coder’s Corner
Topic: Question about Doxygen documentation
Replies: 8
Views: 2283

Re: Question about Doxygen documentation

egallager wrote: November 25th, 2020, 5:28 am Well, if the generated HTML were hosted on the website, users wouldn't have to generate it themselves...
I think he meant most programmers.
by CrawlCycle
November 25th, 2020, 5:10 am
Forum: Coder’s Corner
Topic: Testing puzzles
Replies: 3
Views: 5463

Re: Testing puzzles

I don't like long unreadable names. But why do people still use that? Until I know all of the reason, I probably would still use long names. Alternatively, maybe I can write a custom struct that replaces a long name: Fields for holding the properties of the test An implicit conversion to string.
by CrawlCycle
November 24th, 2020, 4:49 pm
Forum: Coder’s Corner
Topic: Testing puzzles
Replies: 3
Views: 5463

Re: Testing puzzles

How to name a unit test https://stackoverflow.com/questions/155436/unit-test-naming-best-practices https://dzone.com/articles/7-popular-unit-test-naming https://docs.microsoft.com/en-us/dotnet/core/testing/unit-testing-best-practices No double underscore. I am thinking about method_name_StateOfThis...
by CrawlCycle
November 23rd, 2020, 7:04 pm
Forum: Coder’s Corner
Topic: Testing puzzles
Replies: 3
Views: 5463

Testing puzzles

Create a new file for unit tests Create a new file within wesnoth/src/test Add the path of the new file to the list at wesnoth/source_lists/boost_unit_tests I made a typo in wesnoth/source_lists/boost_unit_tests , but CMake didn't warn. Parametrized test Parametrized test has two advantages: It all...
by CrawlCycle
November 22nd, 2020, 11:16 pm
Forum: Coder’s Corner
Topic: Wording and style for Doxygen documentation
Replies: 22
Views: 14632

Re: Wording and style for Doxygen documentation

I think this is good: /** * Get the first node in the list of children with the key. * Return the empty node singleton if we can't find such a node. * @see child(config_key_type, int) */ const config & child_or_empty(config_key_type key) const; /** * Get a node in the list of children with the k...
by CrawlCycle
November 22nd, 2020, 9:15 pm
Forum: Coder’s Corner
Topic: Wording and style for Doxygen documentation
Replies: 22
Views: 14632

Re: Wording and style for Doxygen documentation

Fixed that one.
by CrawlCycle
November 22nd, 2020, 8:59 pm
Forum: Coder’s Corner
Topic: Wording and style for Doxygen documentation
Replies: 22
Views: 14632

Re: Wording and style for Doxygen documentation

This makes sense for database and computer. But does this make sense to humans? /** Get a child by key and then by index. */ This should mean: /** Get all children with the key. Among those children, pick one by index. */ similar to: https://stackoverflow.com/questions/14941366 --♦-- Another issues ...