Git Product home page Git Product logo

Comments (7)

madolson avatar madolson commented on June 22, 2024 4

The only thing I don't like about bool is that:

int isTrue() { return 1 }

is not the same as

bool isTrue() { return true}

Since a bool is only 1 byte. We have actually had production outages because of that mistake at AWS, because we internally use bool in various places, and people didn't understand the difference.

More generally, I prefer the code to more or less all use the same conventions. It's much more important to me to be consistent, since the more we diverge the more folks will poke in and say they want to do something else because that is the way that they like it.

from valkey.

madolson avatar madolson commented on June 22, 2024 1

What's a c++ comment?

I've never heard these be called C++ comments, always single line comments. That just might be because I never write C++ code though :D

from valkey.

madolson avatar madolson commented on June 22, 2024

What's a c++ comment?

from valkey.

zuiderkwast avatar zuiderkwast commented on June 22, 2024

What's a c++ comment?

// "C++ style" line comments are valid in C99

from valkey.

zuiderkwast avatar zuiderkwast commented on June 22, 2024

Let's keep these conventions then. Are they actually written down anywhere?

from valkey.

zuiderkwast avatar zuiderkwast commented on June 22, 2024

They're coming from c++ originally i believe.

https://en.cppreference.com/w/c/comment

from valkey.

hwware avatar hwware commented on June 22, 2024

I remember in very old C, there is no bool type, it is not like C++, which has built-in data type boolean.
After C99, C import bool type, but in low level, i think it need to be converted into integer zero or non-zero value.
Thus, i think in valkey, we do not need to import #include <stdbool.h>.

Personally, I have C++ experience. I still remember when I read redis code initially, because Redis is written by pure C language, I am confused by some C syntax.

from valkey.

Related Issues (20)

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.