Giter Club home page Giter Club logo

gist's People

Contributors

vishwajith-k avatar

Stargazers

 avatar

Watchers

 avatar

gist's Issues

What happens if a variable name is same as an enum value? Can enum value be same as a variable name?

Ans - It depends. Rule - Whenever we try to access something, locals are checked first (afais-een). If enum value and variable are in same scope, then an error is guarantied. But they are in different scopes, then no (compiler) errors for this reason; but you may expect the unexpected behaviors; while coding you may think that you're trying to access a global variable or global enum value, it might have picked local enum value or variable with same name. To avoid this issue, enum are (most-ly ๐Ÿค”) suffixed with _e in standard headers. Like in the case of datatypes being appended with _t.

Is it possible to achieve encapsulation/abstraction in C?

Yes. But may not be achievable in single file. If an identifier is used, it must first be declared/defined earlier. That's not the case with typedef. A type can be aliased to another type even if the first type (that is being aliased) doesn't exist earlier. Compilation succeeds, except some kind of clarification may be needed to run the code. This usage yields opaqueness for a given type. And limits user to use the provided abstraction layer (typically getter, setter) and not the underlying data.

Standard integer types

Why do we need int8_t when we are sure that char consumes same size? Or for that matter why do we need stdint.h itself?

Ans - Till now char on C consumes 1B. But what about int? It varies across machines! So, if you definitely need 32b for your data, then pick uint8_t or int32_t instead of C's keyword based types. With this kind of usage, code change is not required across machines. So the purpose of these types is that, portability. And one more noticeable point is that, these words end with t; which simply means type or typedef.

Tables

  • maintain a md table of format specifiers and corresponding data-types
  • maintain a md table having operators and their precedence (include trigraphs with remarks)

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.