Giter VIP home page Giter VIP logo

Comments (4)

octobanana avatar octobanana commented on May 21, 2024

The current formatting style is quite consistent with itself. When in doubt, looking at the surrounding code and similar sections should help to clarify things. Although, having a format spec would ease code reviews, so I'll have a look.

What do you specifically find unreasonable regarding the current formatting style?

from belle.

WolfgangVogl avatar WolfgangVogl commented on May 21, 2024

Yes, you're right. The formatting is consistent with itself - sorry for the bad explanation/misleading topic.
My problem was that I HAVE TO look at the surrounding code to adapt a foreign code style instead of just write code and let a (formatting) tool do it's job.

Just as an example: When do you write spaces with curly braces initializions?
=> std::string index_file {"index.html"};
You've to find another place with this kind of initializion... some people write
std::string index_file { "index.html" }; or
std::string index_file{"index.html"}; or
std::string index_file{ "index.html" };
Thats annoying extra work with big chance of doing styling wrong.

I couldn't tell you which form of the above example I would write intuitively as I don't really care - I think thats the job of a formatting tool.

from belle.

octobanana avatar octobanana commented on May 21, 2024

I can see how a formatter would make things easier. I haven't had a chance to try out clang-format yet, but I still plan on checking it out.

Interestingly, the example you provided for how spaces are formatted with uniform initialization syntax, has the following surrounding lines:

// the public directory for serving static files
std::string public_dir {};

// default index filename for the public directory
std::string index_file {"index.html"};

// socket timeout
std::chrono::seconds timeout {10};

// serve static files from public directory
bool http_static {true};

// serve dynamic content
bool http_dynamic {true};

// upgrade http to websocket connection
bool websocket {true};

from belle.

WolfgangVogl avatar WolfgangVogl commented on May 21, 2024

It was just an proposal and the example was the first that passed through my mind.

"I couldn't tell you which form of the above example I would write intuitively".

from belle.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.