[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


File: whitemannigger.png (11 KB, 700x513)
11 KB
11 KB PNG
which one is niggerlishlish and which one is divine
>>
assembly
>>
>>106720842
You use punch cards.
>>
>>106720842
>white
Latinos are not white
>>
Just use a regular int if you're writing in C89, otherwise use bool. Don't use unsigned without a specific reason.
>>
>>106720842
It depends.
>>
>>106720842
Trying too hard, Prajesh.
>>
Yea, just use 4 bytes for a flag.
>>
File: 1758373800279140.jpg (42 KB, 350x490)
42 KB
42 KB JPG
>>106720842
enum { OFF, ON } toggle;
is actually correct
>>
>>106721104
uh compiler will figure it out
>>
char toggle = 0;
>>
>>106720842
Do you have 2^64 different states to toggle between? Even if you do, that's only divine when God does it. When you do it, it's niggerlicious.
>>
>>106720842
Depends (use bool)
bool is just a typedef to an unsigned short anyway. Look up bitfields though and see if that's more applicable.
>>106721132
This is based though if it's literally for an on/off switch.
>>
>>106720842
unsigned short toggle: 1;
>>
>>106721104
Unaligned access is slow.
So is access on anything other than a 64-bit boundary.

Use int if you want it fast.
Use bool (which is a char, I think) if you have a million, use bit fields if you have billions of them.
>>
>>106721407
>bool is just a typedef to an unsigned short anyway.
Apparently that hasn't been the case in a while.
> https://github.com/gcc-mirror/gcc/blob/master/gcc/ginclude/stdbool.h
#define bool    _Bool
>>
>>106720842
class Toggle {
public:
bool getState() const noexcept;
void setState(bool value) const noexcept;
void flip() const noexcept;
private:
bool state = false;
};
>>
>>106721292
>>106721407
The key is the difference in semantics between 2^1 states and truth values, switch on truth for a state is mistyped
>>
>>106721504
>>106721407
From the manpage for stdbool.h
       The <stdbool.h> header shall define the following macros:

bool Expands to _Bool.

true Expands to the integer constant 1.

false Expands to the integer constant 0.

__bool_true_false_are_defined
Expands to the integer constant 1.

An application may undefine and then possibly redefine the macros bool, true, and false.
>>
>>106721553
>An application may undefine and then possibly redefine the macros bool, true, and false.
They're keywords now
https://en.cppreference.com/w/c/keyword.html
>>
>>106721527
a man of culture
>>
>>106721527
>>106721605
class in to a keyword in c
>>
>>106720842
"bool" is more idiomatic, but you should not use bool on a public API.
>>
>>106721617
in English, Rajeesh.
>>
>>106720842
if you cant functional program you are not white
>>
>>106720842
bool is gay
>doesn't serve a true purpose
>only takes you further from the ground truth of what actually happens
>possibly adds extra stuff to make sure it actually only stores 0 or 1
bool was never needed, just like all C++ heresies
>>
>>106721030
>Just use a regular int if you're writing in C89, otherwise use bool. Don't use unsigned without a specific reason.
this is a retarded boomer rule of thumb that makes absolutely no sense. Unsigned is the default state of an integer, signed is only if you need negative numbers.
typedef unsigned char BOOL;
#define TRUE 1
#define FALSE 0

>>106721494
>Unaligned access is slow.
Retarded boomer take again. Unaligned access is not slow on standard ARM or x86 processors unless you are dealing with SIMD. Furthermore, a single byte can never be "unaligned".



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.