1

In C language code, if I have a bunch of variables that will be used only for logical operations, what is the data type that will yield the fastest execution time?

Also, does it depend if I'm using an ARM or Intel processor, 32-bit or 64-bit system?

5
  • 8
    premature micro-optimisation? Commented Feb 17, 2013 at 3:09
  • 1
    Make a typedef, then benchmark. Best way to know. Commented Feb 17, 2013 at 3:10
  • stackoverflow.com/a/1921557 Commented Feb 17, 2013 at 3:10
  • Just use _Bool and if you find that too slow then that's when you should consider optimisations. Commented Feb 17, 2013 at 3:12
  • Where did you get the impression that C has "execution time"? This is a concept that comes from implementations of the C language, not from the C language. Your question is a bit like "What is the fastest accent, tone and/or volume to speak English in?". Commented Feb 17, 2013 at 3:58

1 Answer 1

5

If the compiler allows, include <stdbool.h>, use bool, and trust the compiler/RTL vendor to do the right thing. Otherwise use int.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.