Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

Do you #define booleans?

Name: MILKRIBS4k 2009-06-23 7:30

Do you? What's wrong with simple one and zero?

Name: Anonymous 2009-06-23 7:47

I use three-value logic.

Name: Anonymous 2009-06-23 8:02

#define one true
#define zero false

Name: Anonymous 2009-06-23 8:34

i #define worlds

Name: FrozenVoid 2009-06-23 8:35

writing 0/1 is faster.

__________________________________
http://xs135.xs.to/xs135/09042/av922.jpg
orbis terrarum delenda est

Name: Anonymous 2009-06-23 8:39

It improves readability. When someone compares something to 1, I don't know whether that's a numeric 1 or a boolean 1.

In before the whitespace guy says that writing 0 and 1 is faster and takes leaa space

Name: Anonymous 2009-06-23 9:30

>>6
you should be using if(value) or if (!value) for expert c

Name: Anonymous 2009-06-23 9:38

I do this

#define true 0
#define false 1

Name: Anonymous 2009-06-23 9:53

ermmm.

#define true 1
int x = 10;
if(x == true){
   //am i the only one who sees the problem here?
}

Name: Anonymous 2009-06-23 9:58

>>9
== true is redundant and should always be removed.

Name: Anonymous 2009-06-23 10:07

>>10
Not in real C. Also, real C uses long variable names like *pointer_to_stack_top rather than *sp, and .h files for every single definition. Real C.

Name: Anonymous 2009-06-23 10:10

>>11
What the hell is ``real'' C?

Name: Anonymous 2009-06-23 10:16

>>12
Real C. Where you get a job and code in C for money. Real C. Not nano and true and emacs. Real C.

Name: Anonymous 2009-06-23 10:21

>>13
But C doesn't even have true

Name: Anonymous 2009-06-23 10:28

>>14
man true
Not real C.

Name: Anonymous 2009-06-23 10:29

>>15
Real C is not used on operating systems that provide man.

Name: Anonymous 2009-06-23 10:39

>>16
There is a conceptual problem with defining things by what they are not. If there is a real C, it is real C, and not not not real C.

Name: Anonymous 2009-06-23 10:46

i like real C because it never lets me relax and keeps me real

Name: Anonymous 2009-06-23 10:50

#include <stdbool.h>
The best part is how the code won't compile on obsolete compilers stuck in the 80s.
I make sure to throw in some complex math so people can't just switch to C++ as a workaround, of course.

Name: Anonymous 2009-06-23 11:27

>>13
code in C for money? Did you mean Scalable Enterprise Solutions or Code for Food?

Name: Anonymous 2009-06-23 14:42

Because the operating system expects 0 return value for true (ran well) and nonzero for false (did not run well). It's for interchange between different truth values as well (for instance, some skeleton code with extensive use of 0 and 1 may be copied and used in different files where different truth values are expected (for example, different file identity structures that all return TRUE values, but the single calling function expects them to be differentiable by return value alone), which would need either changing each 1 for another number or using TRUE in the first place and simply redefineing that.

Name: Anonymous 2009-06-23 14:55

>>19
EXACTLY!
USE stdbool.h GOD DAMN IT.
AND USE stdint.h IF YOU CARE ABOUT 32/64-BIT PORTABILITY.

Name: Anonymous 2009-06-23 15:05

>>22
stdbool.h is bloat. I cannot imagine any things other than the two truth values that could be defined, and I cannot imagine a librrry defining just two constants, so there must be more useless bloat in there.

Name: Anonymous 2009-06-23 15:06

>>1
Holy crap, it's the anus!

Name: Anonymous 2009-06-23 21:26

>>23

#ifndef _STDBOOL_H
#define _STDBOOL_H

/* believe it or not but the Single Unix Specification actually
 * specifies this header, see
 * http://www.opengroup.org/onlinepubs/007904975/basedefs/stdbool.h.html */

#define bool _Bool
#define true 1
#define false 0
#define __bool_true_false_are_defined 1

#endif

Name: Anonymous 2009-06-24 1:51

>>11
putting a variable's type in its name
I hate real C.

Name: Anonymous 2009-06-24 1:51

>>25
You're in luck. Mine has got GNU bloat all over it. WTF, C++ support‽

Name: Anonymous 2009-06-24 2:14

Can someone explain why true is 1 and not !false ?

Name: Anonymous 2009-06-24 2:29

>>28
For the same reason false isn't ((1 + 3) / 2) ^ 2.

Name: Anonymous 2009-06-24 2:51

>>25
/* believe it or not but the Single Unix Specification actually
 * specifies this header, see
 * http://www.opengroup.org/onlinepubs/007904975/basedefs/stdbool.h.html */
it's C that specifies it, not SUS.

>>25
get a better operating system.
no GNU bloat here:
/* $MirOS: src/include/stdbool.h,v 1.2 2007/09/21 10:43:36 tg Exp $ */
/* $OpenBSD: stdbool.h,v 1.3 2004/10/02 12:55:31 espie Exp $ */

/*
 * Written by Marc Espie, September 25, 1999
 * Public domain.
 */

#ifndef    _STDBOOL_H_
#define    _STDBOOL_H_   

#ifndef __cplusplus

#if (defined(__GNUC__) && __GNUC__ >= 3) || defined(__PCC__)
/* Support for _C99: type _Bool is already built-in. */
#define false    0
#define true    1

#else
/* `_Bool' type must promote to `int' or `unsigned int'. */
typedef enum {
    false = 0,
    true = 1
} _Bool;

/* And those constants must also be available as macros. */
#define    false    false
#define    true    true

#endif

/* User visible type `bool' is provided as a macro which may be redefined */
#define bool _Bool

#else /* __cplusplus */
#define _Bool     bool
#define bool     bool
#define false     false
#define true     true
#endif /* __cplusplus */

/* Inform that everything is fine */
#define __bool_true_false_are_defined 1

#endif /* _STDBOOL_H_ */

Name: Anonymous 2009-06-24 2:54

>>30
it's C that specifies it, not SUS.
It's both. The C standard has specified it since C99, and inherited it from SUS.

Name: Anonymous 2009-06-24 3:02

>>31
http://www.opengroup.org/onlinepubs/000095399/basedefs/stdbool.h.html and http://opengroup.org/onlinepubs/9699919799/basedefs/stdbool.h.html say:
The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional. This volume of IEEE Std 1003.1-2001 defers to the ISO C standard.

Name: Anonymous 2009-06-24 3:04

>>30
get a better operating system.
no bloat at all here:

#ifndef    _STDBOOL_H_
#define    _STDBOOL_H_
#define bool _Bool
#define true 1
#define false 0
#define __bool_true_false_are_defined 1
#endif

Name: Anonymous 2009-06-24 3:12

>>33
no support for compilers that don't provide _Bool. and no support for sepples, but sepplesfags should be used to not getting all the cool C features so that's ok.

Name: Anonymous 2009-06-24 6:34

>>30
#define bool     bool
#define false    false
#define true    true
I think my head just exploded.

Name: Anonymous 2009-06-24 14:03

>>34
no support for compilers that don't provide _Bool
You do know that each compiler vendor ships their own standard library which is tailored to use the facilities available in the compiler, right? So, a compiler that doesn't support _Bool wouldn't come with a stdbool.h that uses _Bool, naturally.

HIBT?

Name: Anonymous 2009-06-24 16:46

Yeah I have to define true and false because of my peers. They still can't accept that there are no bools in manly C and get confused if I use if(!someinteger).

Name: Anonymous 2009-06-24 16:57


#define true false
#define false true

Name: Anonymous 2009-06-24 17:07

>>38
Reminds of the highly amusing
#define less more
#define more less

Less is more

Name: Anonymous 2009-06-24 17:30

>>36
If you have to ask ...

Name: Anonymous 2009-06-24 17:49

>>40
We have a saying back in Texas;
If one ever utters the acronym, ``HIBT?'', then it is highly likely that they have been.

Name: Anonymous 2009-06-24 21:22

>>41
Oh, you Texicans and your crazy abandon of pronoun consistency moe.

Name: Anonymous 2009-06-24 23:53

>>42
I don't know what passes for grammar in New York City, but those pronouns are plenty consistent.

Name: Anonymous 2009-06-25 0:00

protip: define macros with the name split across lines so that people can't search for it:

#define foo\
bar 10

Name: Anonymous 2009-06-25 0:40


#\
d\
e\
f\
i\
n\
e\
 \
t\
r\
u\
e\
 \
1

Name: Anonymous 2009-06-25 0:46

>>45
Expert Macroing

Name: Anonymous 2009-06-25 1:12

>>44
Very good tip, thanks!

Name: Anonymous 2009-06-25 1:32

You do know that each compiler vendor ships their own standard library which is tailored to use the facilities available in the compiler, right?
actually most compilers just use the system's libc.

Name: Anonymous 2009-06-25 1:49


#\
e\
r\
r\
o\
r\
 \
"\
C\
O\
C\
K\
S\
"

Name: Anonymous 2009-06-25 7:01

#define true -1
#define false 0

Name: Anonymous 2009-06-25 11:05

#define true "true"
#define false "false"

Name: Anonymous 2009-06-25 11:13

What are the rules for preprocessor processing?

What happens if you do:

#define true false
#define false true
printf("%d\n", false);


What about

#define "one" "two"
#define "two" "three"
#define "three" "one"
printf("%s %s %s\n", "one", "two", "three");


Sorry, don't have a C compiler at hand to test. I do know some defines might apply one after another, but not the fine rules of them.

Name: Anonymous 2009-06-25 11:18

#\
a\
c\
a\
t\
i\
s\
f\
i\
n\
e\
t\
o\
o

Name: Anonymous 2009-06-25 11:23

>>52
Try it!

Name: Anonymous 2009-06-25 12:17

>>52
Each definition may be expanded not more than once.
Also, you can't have `#define "one" something`.

    #define one two
    #define two three
    #define three one // comment this line to see that the stuff is really expanded.
    #define stringize(s) #s
    #define stringize_expand(s) stringize(s)
    printf("%s", stringize_expand(one));

Name: Anonymous 2009-06-25 13:01

>>55
printf(stringize_expand(one) "\n");
OMG OPTOMISED

Name: Anonymous 2013-04-22 22:26

aye

Name: Anonymous 2013-04-23 13:55



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Name: Anonymous 2013-04-23 14:05



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Name: Anonymous 2013-04-23 14:13



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Name: Anonymous 2013-04-23 14:27



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Name: Anonymous 2013-04-23 14:41



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Name: Anonymous 2013-04-24 0:10

/* A verbose construct like
 *
 *     if (cond == FALSE)
 *
 * instead of
 *
 *     if (cond)
 *
 * is passable only if it is equivalent to the terser form.
 */
#if false || FALSE
#error you're not clever
#endif

/* Don't tempt stupidity like
 *
 *     cond = 2;
 *
 *     ...
 *
 *     if (cond == TRUE)
 */
#if defined(true) || defined(TRUE)
#error Sepples-like thinking detected
#endif

Name: Anonymous 2013-04-24 0:22



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Name: Anonymous 2013-04-24 0:30



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Name: Anonymous 2013-04-24 0:37



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Name: Anonymous 2013-04-24 0:43



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Name: Anonymous 2013-04-24 0:54



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Name: Anonymous 2013-04-24 1:01



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Name: Anonymous 2013-04-24 1:12



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Name: Anonymous 2013-04-24 12:42



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Name: Anonymous 2013-04-24 12:47



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Name: Anonymous 2013-04-24 12:52



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Name: Anonymous 2013-04-24 12:57



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Name: Anonymous 2013-04-24 13:03



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Name: Anonymous 2013-04-24 13:08



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Don't change these.
Name: Email:
Entire Thread Thread List