One year of C - <AUTHOR> http://floooh.github.io/2018/06/02/one-year-of-c.html <comment><USER3> Redescovering the beauty of C seems quite similar to city-dwellers redescovering the beauty of nature: everything is rainbows and butterflies, while in reality - if you are away from the safety net of civilisation - <USER2> are hundreds of ways nature will crush you if you make even a small mistake.

<comment><USER4> And then you have the rugged outdoorsmen get serious about nature and venturing into the wilderness. They plan for the worst. They bring enough supplies. They don't try to climb mountains in flip flops. They shake their fists at the city touristers leaving trash at the campsite and causing memory leaks. No garbage collectors out here. They know to respect the ecosystem flora and fauna or get ripped to pieces.

<comment><USER5> and then there's the guy whose back in the city who knows the world is designed by aliens and that nature is artifice, all decent processor architectures are designed using dataflow HDL languages and the notion of "bare metal" nature is a delusion held by hipsters and unix greybeards

<comment><USER6> But god created in nature three basic elements (resistance, capacitance and inductance) and with holy will and power forged the foundations. The wisdom of the first borns say there are more basic elemental that god intended (memristors...)

<comment><USER7> But even these are approximations and false gods.

Electromagnetism and solid-state physics are more fundamental still.

</comment></comment></comment></comment></comment><comment><USER8> > no actions need to happen on destruction

so... you like never free, never fclose, never munmap, never pthread_join, never unlock mutexes, never close network connections or what ?

Also, all of your protoypes such as

        sg_pipeline sg_alloc_pipeline() {

should really be

        sg_pipeline sg_alloc_pipeline(void) {

since the first one can actually be called with any number of arguments (in C, not in C++).

Note also that C doesn't have return-value-optimization, hence all your struct-returning functions can possibly cause a call to memcpy (won't happen when compiled in C++ mode of course) and will generally lead to much more binary bloat than the traditional C way of passing outputs as arguments. e.g. given this trivial code in foo.c:

        typedef struct _foo
        {
            int x;
            float foo, bar;
            char z[1024]; // change this to 10024 to get a memcpy!

        } foo;

        void do_stuff_to_foo(foo*);

        foo blah()
        {
            foo f;
            do_stuff_to_foo(&f);
            return f;
        }

A disassembly after compilation with gcc -std=c99 -O3 gives

        blah:
        .LFB0:
    	pushq	%rbp
    	movq	%rdi, %rbp
    	pushq	%rbx
    	subq	$1064, %rsp
    	movq	%fs:40, %rax
    	movq	%rax, 1048(%rsp)
    	xorl	%eax, %eax
    	movq	%rsp, %rbx
    	movq	%rbx, %rdi
    	call	do_stuff_to_foo@PLT
    	movq	(%rsp), %rax
    	leaq	8(%rbp), %rdi
    	movq	%rbp, %rcx
    	andq	$-8, %rdi
    	movq	%rbx, %rsi
    	subq	%rdi, %rcx
    	movq	%rax, 0(%rbp)
    	movq	1028(%rbx), %rax
    	subq	%rcx, %rsi
    	addl	$1036, %ecx
    	movq	%rax, 1028(%rbp)
    	shrl	$3, %ecx
    	rep movsq
    	movq	1048(%rsp), %rdx
    	xorq	%fs:40, %rdx
    	jne	.L5
    	addq	$1064, %rsp
    	movq	%rbp, %rax
    	popq	%rbx
    	popq	%rbp
    	ret

The same thing built with g++ -O3 gives

        _Z4blahv:
    	pushq	%rbx
    	movq	%rdi, %rbx
    	call	_Z15do_stuff_to_fooP4_foo@PLT
    	movq	%rbx, %rax
    	popq	%rbx
    	ret

While clang (in C mode) goes for a memcpy:

        blah:                                   # @blah
    	pushq	%r14
    	pushq	%rbx
    	subq	$1048, %rsp             # imm = 0x418
    	movq	%rdi, %rbx
    	movq	%fs:40, %rax
    	movq	%rax, 1040(%rsp)
    	movq	%rsp, %r14
    	movq	%r14, %rdi
    	callq	do_stuff_to_foo@PLT
    	movl	$1036, %edx             # imm = 0x40C
    	movq	%rbx, %rdi
    	movq	%r14, %rsi
    	callq	memcpy@PLT
    	movq	%fs:40, %rax
    	cmpq	1040(%rsp), %rax
    	jne	.LBB0_2
    	movq	%rbx, %rax
    	addq	$1048, %rsp             # imm = 0x418
    	popq	%rbx
    	popq	%r14
    	retq

<comment><USER9> > Note also that C doesn't have return-value-optimization, hence all your > struct-returning functions will cause a call to memcpy (won't happen when > compiled in C++ mode of course).

What ?

RVO is precisely needed because a copy in C++ can run arbitrary code and so is not as easy to ellide as a memcpy. RVO is basically a promess you make to have your copy constructor & destructor be semantically harmless compared to a memcpy.

There is no need for RVO in C.

<comment><USER10> That was exactly my thought as well, but the examples seems to show otherwise (at least on gcc and clang[1]).

The compilers are using basically the same underling optimizer and back-end with different front-ends, and since in C there are no "user-defined constructors" and no destructors, one would expect that you don't need any special RVO rule in C: the compiler can simply observe that a local object is returned and construct it in-place as necessary.

Thinking about this example, this may not be the case: distinct objects have to have distinct addresses, right? So in C you might not be able to make this optimization since the do_stuff_to_foo method (a black box to the compiler) could save its argument, and the caller of blah() could see that the argument it passed has the same address as the local f object in blah, a violation of "distinct objects, distinct addresses".

C++ has a the RVO escape hatch for this: it is expected that some objects that appear distinct in the source may not actually be distinct if they fit the RVO (or NVRO) pattern - but C does not. So perhaps gcc and clang are doing the right there here.

\---

[1] All numbered versions of clang up to 6.0 seem to behave the way indicated in the GP post, but trunk in godbolt, which shows version as 7.0.0 (trunk 333657) compiles C efficiently like C++.

<comment><USER9> very good point on the "addresses compare == iff same object" rule.

In that case though, I think clang is right to optimize the callee (but it does introduce a problem in the caller) :

the only place you could do the equality check and observe the rule being broken is before the callee returns since the lifetime of its variable is bound to the call.

It seems that clang will not let the return pointer alias a local in the caller except when the call is the initialization of said local.

So if the caller goes :

foo x; leak(&x); x = returns_foo();

the memory will be temporary stack (and then memcpy), thus upholding the rule. (and it seems to me that this inefficiency is really required to respect the standard if we actually leak the pointer)

in the case :

foo x = returns_foo();

clang will pass the actual address of x down but that's before the object exists (and its address cannot be known yet) so the rule is still fine.

I stand corrected though, this does mean that RVO would be useful for C as well, as a way to relax the aliasing rule.

edit: nevermind that, in the first case it's perfectly legal to read/write foo through the pointer downstream so you cannot make the optimization anyway.

<comment><USER10> Yes, the same thought occurred to me (that perhaps clang is careful in the caller in the case the address escapes), but I seemed to find cases where clang optimizes the caller also, so that two distinct objects receive the same pointer and both pointers escape.

Here's an example:

[https://godbolt.org/g/yxFzqT](https://godbolt.org/g/yxFzqT)

This happens on clang versions back 3.6.

Note that if you change the caller to:

        Foo f;
        f = callee(&f);

the code changes and distinct objects are passed. I'm not sure if the first form (all in the definition) has a relevant difference per the standard that lets clang do this.

</comment></comment></comment></comment></comment><comment> nevi-me The author makes an important point about having a list of languages to choose from.

We are working on a JVM-based project at work. We chose to use Kotlin because the initial team was intermediate programmers who didn't have that much experience. When we got an MVP out, and some clients willing to pay for the solution; we got some Java devs involved.

The guys have only known Java 6 and 7. They are struggling around with Kotlin, not because it's difficult, but because they only know "The Java Way". Sadly also, they've been stuck in J6/7 for so long that they don't know Streams or Lambdas. For people making their living from Java, that's dangerous self- extinction.

Their software architect is even worse. Ignorant guy who lives in a rock, if they don't understand something or have never heard of it, it's wrong or useless.

We're working on a greenfield project, and the guy wanted to write a REST proxy on top of gRPC because he thinks clients won't like us having ports exposed internally.

I nearly took him for his salary when I told him that *://localhost is only visible to the local machine. He bet me his salary that he could access a service on the server even if it's listening on localhost. I was gracious when it came time to pay up.

Anyways, I wish the guys were the exception, but I've seen many guys in their 30's who still think Oracle Inc. is where the sauce is.

My advice: learn something new every once in a while. The author found that C was better suited for some things than C++. That's a powerful statement to make, something I've learnt a lot over the years when I pick up a new language.

<comment><USER11> You got a point, but being stuck into older language versions is quite common on enterprise shops.

If the server they have to take care of only runs language version X, that is what they care about, after work there is another life totally away from computers.

When time comes for language X + 1 version to be replaced on the deployment system, then there will be one week of web based trainings to learn whatever is new in version now available on the IT development images and that is it.

Yes, there are lots of modern companies out there, but there are tons of them, specially when software is not their core business where development improvements come at snail speed, if at all.

</comment></comment><comment><USER12> > The dangers of pointers and explicit memory management are overrated

Hummm, not my experience. The first time I ran AFL on one of my C library (parser/converter of EMF files, really easy to mess up), the result was quite frightening. IIRC, it took only 20 seconds for AFL to find 10 crashes.

Ever since, first I'm more careful, second I run AFL from time to time, and it happens regularly that it catches some edge cases I was not able to see.

I love programing in C, but I definitively know it's easy to make mistakes in it.

<comment><USER13> What's AFL?

<comment><USER12> American Fuzzy Lop.

[http://lcamtuf.coredump.cx/afl/](http://lcamtuf.coredump.cx/afl/)

And no, it's not the rabbit ^^.

It's an 'intelligent' (as opposed to purely random) fuzzer that is quite good at finding edge cases (it's a very/too short summery, please read the link for more details).

</comment></comment></comment><comment><USER14> I like this blogpost. But as stated in it, "my project". Writing C project, alone is pretty different than writing C with 1 or more persons.

In highschool we had group project. Writing simple tcp/ip protocol in C. Holy shit did I see some awfull things... maybe writing C is not the _bad_ thing about it. But maintaining could be.

Simple example, you can read string from simple data file on 6,7 different ways. Yet their effects and behaviors differ severely. Not everyone knows difference in parameters and returns in scanf, fgets and gets...

<comment><USER15> I think your experience writing C with a group might be severely colored by the group being made up of inexperienced highschoolers.

<comment><USER14> I totally agree with you on that. But the whole point was that there is much certain possibility for things to go wrong with inexperienced developers. I won't quote the comment in the reply below, but that is the thing...

edit: typing on the phone, sorry

<comment><USER15> In my experience, turning an inexperienced C developer loose with C++ does not result in an improvement :-).

</comment></comment></comment></comment><comment><USER16> > btw, did you notice how there are hardly any books, conferences or > discussions about C despite being a fairly popular language?

Oh, yes. When I wanted to fiddle with OpenGL (and later SDL), I was baffled to find that absolutely _everything_ documentation-wise was for C++.

EDIT: Sorry, "documentation" was probably the wrong word to use here. I meant "learning resources".

<comment><USER17> Hum. That doesn't make sense, the OpenGL API is entirely C oriented and I don't know of any C++ docs.

<comment><USER18> It doesn't make sense, but it jibes with my experience. Tutorials and blog posts about OpenGL are super heavy on C++, because gaming.

The official docs are C, of course, because the API is C. But the docs are rather abstruse for a beginner, and really become useful only well after you've gotten your bearings. (e.g. my personal beef: function names tend to be two nouns with no verb to say what the thing actually does, so you look in the docs and it says it "binds" noun A and noun B, with no explanation of what "binds" means in context, which direction the data binding goes, whether it persists, etc.)

</comment></comment></comment><comment><USER19> I have more uses for Python than the author, but one of these uses is really obvious: Python as C code generator. Python + C is a very powerful combination: metaprogramming, special constructs etc. Basically, with Python you can get rid of preprocessor hacks and messing with templates.

<comment><USER20> Ah, right! I actually use python for code generation as well, just forgot to mention it. For instance the Z80 and 6592 CPU emulators use generated code for the instruction decoder:

[https://github.com/floooh/chips/tree/master/codegen](https://github.com/floooh/chips/tree/master/codegen)

</comment></comment><comment><USER21> As someone said, "C is an improvement on its successors"

<comment><USER22> Tony Hoare, "hints on programming language design":

>> The more I ponder the principles of language design, and the techniques which put them into practice, the more is my amazement and admiration of ALGOL60. Here is a language so far ahead of itst ime, that it was not only an improvement on its predecessors, but also on nearly all its successors. <<

[http://flint.cs.yale.edu/cs428/doc/HintsPL.pdf](http://flint.cs.yale.edu/cs428/doc/HintsPL.pdf)

<comment><USER21> Ah, nice. Thank you. I knew I had seen it somewhere.

</comment></comment></comment><comment><USER23> C is beautiful because it is so barebones. It does not hide data behind complex language feature that describe some runtime behaviour it is just bits and bytes moving around. A bit of a romanticed view but that is atleast the feeling I got when writing some small games witg C.

Link: [https://github.com/Entalpi/PongC](https://github.com/Entalpi/PongC)

</comment><comment><USER24> > As a C++ programmer I developed my own pet-coding-patterns and bad > behaviours (e.g. make methods or destructors virtual even if not needed, > create objects on the heap and manage them through smart pointers even if > not needed, add a full set of constructors or copy-operators, even when > objects weren't copied anywhere, and so on)

Yikes.

<comment><USER25> I guess you are getting down voted for lack of content, but I agree. Those are all very bad "Java without GC" C++ practices that lead to awful code bases. Thankfully the author seems to have learned that from their experience writing C.

Like the author mentions, C++ leads to overthinking which language features to use. It invites you to seek these perfect abstractions for Python readability with C performance. I think this is a big reason everyone develops their own incompatible style -- not due to passionate philosophical beliefs, just to reduce the size of the solution space.

<comment><USER26> I agree with you, mainly from the perspective of writing Rust code. When Rust was new, a lot of people said that thinking about ownership all the time is a burden, but I think it's the opposite, it gives a sort of frame that helps to build the software's core abstractions. I think in this regard C++ is much more unopinionated, which means every codebase is different. In Rust, ownership is part of the type system, so a lot of the times learning a new API can be much faster because API usage is easier to understand and this style of programming is already familiar.

<comment><USER25> yes. ownership is an extremely critical part of software design, especially for complex interactive programs.

</comment></comment></comment></comment><comment><USER26> I thought when people say memory safety in C is a problem, they usually mean in a larger codebase with hard to define API boundaries and with multiple programmers that can't handle the complexity of the code, which results in a team that can't find a single person that is familiar with the whole codebase.

<comment><USER27> As a C coder I find myself trampling over my own memory a lot.

Say you have a pointer somewhere that points to a struct, and then once every 10 million iterations of a set of 20 functions that pointer gets written over by a string that lacks a NULL terminator occasionally. So your program crashes in a completely random place that has nothing to do with the origin of the bug. That's the problem with memory safety. But the lack of memory safety is also very powerful, you can malloc a chunk of memory and then use it in extremely creative ways, you really see some peoples genius shine when you read their source code, in a way that I haven't been able to see with other languages.

<comment><USER28> This is soved by knowing the destination size and using functions that respect that and never assume the size of an input will not be larger. (unless proximity of something that would assure the size of input is close enough to where you're making the assumption about it in code, but still you'd be taking risks, especially if it's not your code, but some foreign library call)

It's the same with web programming. You always escape on the output, or just avoid escaping by using proper API (el.textContent = 'something').

</comment></comment></comment><comment><USER29> Very cool read and a lot of your happy discoveries are similar to reasons why I like coding in Go, especially your "Less Language Feature 'Anxiety'" section. No guessing about how to do something, there's generally only one way to do something.

</comment><comment><USER30> I'm not a professional coder atm, but I learned quite a lot from "Understanding and Using C Pointers." It's weird knowing that I like to and can code, but being employed as a sys admin. Pretty common I imagine, as well.

</comment><comment><USER31> I made that 'reverse path' to C quite a while back, more than 10 years ago in fact. for 20 years before that, I was C++, C++, and C++. Then I gradually realised I was trying to slim down my use of the language, due to stuff I just didn't want in the codebase I was working on.

Small details. Like well templates -- they were fantastically hard to track and debug at the time, and really, did they actually provide anything in the long run? Answer was... NO. they don't. Turns out it's a LOT easier to have 2 discrete functions _explicitly_ doing the same thing than using a template. _anyone_ will understand the scope of each if they see them; The arguments about "simplicity" doesn't exist once you get templates involved.

So yes, you can 'template' in C as well using the preprocessor, but it's still ends up being MORE READABLE than a heap of scopeless C++.

One thing I was fond of in C++ were stacked based objects; ie, use the constructor to save some state, and use the destructor to restore it. I think it is a lovely concept, and I still miss it -- hover it's a concept 'new hires' had problems with very often -- it was not as intuitive as it felt. It turns out an _explicit_ save/restore is better to maintain. I wish it was different, but that got THAT feature of C++ out of the window.

Anyway, long story short, I wrote zillions of lines of C++, and now I just do C. I don't have to fight with the compilers every other year for instance.

Small silly example, for a million years (it felt like it!) I could write pure virtual functions declarations as ..... int blah_blah_method(some cool parameter) = NULL; -- it actually made SENSE. Then one day, someone decided it couldn't possibly be NULL -- it _had_ to be zero as '0' or else, no compily.

^^ that is one just a silly old single example, but theres a dozen others where your 2 years old codebase suddenly isn't compiling because someone decide to shift the language under your feet.

THAT doesn't happen with C. C just _works_. yes, there's lots of syntax sugar I WISH I would have been able to keep from C++, but ultimately, the possibility to write a huge pile of bloat is _a lot harder_ in C than in C++. Some idiot 'new hire' won't make a hash objects for 5 elements.

Some idiot colleague won't decide that the string creation class constructor shouldn't take a reference, but a copy, making the app startup take 30 seconds with ONE character '&' removal.

Anyway, rant over. Regardless of what the kids says, C is nice, C is lean, C is a LOT easier to keep clean as long as the adult people using it are aware of the sharp edges :-)

<comment><USER32> Your post is very ranty, i disagree with lots, but I think you're flat out wrong here:

> Turns out it's a LOT easier to have 2 discrete functions explicitly doing > the same thing than using a template

How do you write containers? I tried following a series on implementing an interpreter in c a few months ago, but gave up because 30% of the code was implementing std::vector for different types.

Also, math routines definitely work better templated. Code duplication isn't always bad but if your methods are copy and pasted with different signatures, that sucks. E.g. an interpolation method that works on double and floats.

> ome idiot colleague won't decide that the string creation class constructor > shouldn't take a reference, but a copy, making the app startup take 30 > seconds with ONE character '&' removal.

This isn't an argument against c++, this is an argument against your co workers. The exact same argument could be made for C with removing two * signs.

C has it's fair share of gotchas thy you don't refularly hit in c++ too - malloc requiring sizeof, not checking realloc's return values, goto hell for resource cleanup, complicated lifetimes.. personally I'd rather have C++, warts and all, than have to deal with the "simplicity" of reimplementing a stack in every resource owner, and reimplementing vector/map for every type.

<comment><USER33> For C vectors, look at stb's[1] stretchy_buffer[2] or klib's[3] kvec[4].

The basic concept of these is they use macros to specify the type/size of the elements so you can have generic containers in C.

For hash's, you can also look at klib's khash [5]

[1] [https://github.com/nothings/stb](https://github.com/nothings/stb)

[2] [https://github.com/attractivechaos/klib](https://github.com/attractivechaos/klib)

[3] [https://github.com/nothings/stb/blob/master/stretchy_buffer....](https://github.com/nothings/stb/blob/master/stretchy_buffer.h)

[4] [https://github.com/attractivechaos/klib/blob/master/kvec.h](https://github.com/attractivechaos/klib/blob/master/kvec.h)

[5] [http://attractivechaos.github.io/klib/#Khash%3A%20generic%20...](http://attractivechaos.github.io/klib/#Khash%3A%20generic%20hash%20table)

<comment><USER32> > The basic concept of these is they use macros to specify the type/size of > the elements so you can have generic containers in C.

I figured as much. As bad as templates are, I'd take templates over macros any day, especially if I have to debug one.

<comment><USER34> A 1-line macro is not bad. stb's stretchy_buffer is not bad, but it could do with less macros. Take the ones from my own example that I linked elsewhere on this page.

If you use macros "correctly" there is rarely any logic in there, and they are decidedly not hard to debug. Macros let you do things that you could not do otherwise, like getting information about the caller or the size of the element type that is abstracted behind a void ptr.

C++ templates on the other hand - if you have considerable C++ experience you will shy them. They drive compile times up insanely, and are actually very difficult to debug, at least under "normal" usage.

Also, code bloat results after a few instanciations where a simple runtime integer could be used to discriminate between different cases, but with shared implementation code.

I would never again touch even the most basic C++ template, that is std::vector. I prefer my simple 3 lines of macros.

</comment></comment></comment></comment></comment><comment><USER35> > _Writing C++ classes often involves writing constructors, destructors, > assignment- and move-operators, sometimes setter- and getter-methods… and so > on. This is so normal in C++ that I only really recognized this as a problem > when I noticed that I didn't do this in C._

POD containers don't ever need manually written copy/move/assign constructors or destructors. In fact hardly anything except resource managing classes need them (eg if you are implementing shared_ptr or mutex yourself). If you are writing your own copy constructor without knowing why, your code is not only needlessly bloated but also most likely broken. Follow "rule of zero" instead.

</comment><comment><USER36> Does anyone know more examples of C APIs where the user is responsible for allocating data and where all the functions only "borrow" pointers? Is getting rid of malloc/free worth the loss of information hiding?

<comment><USER37> Pretty much the vast majority of the API out there? Only relatively new ones like asprintf or getdelim do memory allocation for you.

I don't understand your remark about information hiding. How does the difference between returning an owned pointer and borrowing a pointer concern information hiding?

<comment><USER36> If your function operates with a pointer to a struct you don't need to put the contents of the struct in the header file. You can simply declare the struct with

        struct mystruct;

and then use `mystruct*` in the function prototypes. I think in C++ this is known as the PIMPL pattern.

I was also asking more about user-defined libraries than about the standard library...

<comment><USER38> Opaque types do not force you to do the allocation in the library.

my_lib.h:

      struct my_struct;

      size_t my_struct_size(void);

      #define MY_STRUCT_MAX_SIZE 512
      #define MY_STRUCT_VAR(name) \
        char name##_buf__[MY_STRUCT_MAX_SIZE]; \
        struct my_struct* name = name##_buf__

      void my_construct(struct my_struct*, int, float);

my_lib.c:

      struct my_struct {
        int i;
        float f;
      };

      size_t my_struct_size(void) {
        return sizeof(struct my_struct);
      }

      void my_construct(struct my_struct* ms, int i, float f) {
         ms->i = i;
         ms->f = f;
      }

user.c:

      // On the heap
      struct my_struct* ms = malloc(my_struct_size());
      my_construct(ms, 123, 456.0f);

      // On the stack
      MY_STRUCT_VAR(ms2);
      my_construct(ms2, 123, 456.0f);

<comment><USER36> Do you know of any libraries that do this?

When I tried it here GCC complained about `ms2 = ms2_buf__` being an assignment between incompatible pointer types. That sounds like an easy way to get into trouble and undefined behavior.

<comment><USER38> I just wanted to convey the idea so I didn't compile or check the code. But now that you bring up UB, I would change the MY_STRUCT_VAR macro as follows:

      #define MY_STRUCT_VAR(name)                          \
          _Alignof(max_align_t)                            \
           unsigned char name##_buf__[MY_STRUCT_MAX_SIZE]; \
          struct my_struct* name = (struct my_struct*)name##_buf__

Ie, changed to unsigned char and set the buffer to have the maximum (strictest) alignment. And added the cast.

It's a pretty widely-used technique and I have satisfied myself in the past that it's not UB (ie, by checking the Standard). I am no language lawyer though so don't take my word for it. The heap example, on the other hand, is pretty much identical to what an allocation inside your library would look like so feel free to disregard the stack example if you'd like.

One example of something based on the same principle is the 'sockaddr' structure in the BSD sockets API. See [https://en.wikipedia.org/wiki/Type_punning#Sockets_example](https://en.wikipedia.org/wiki/Type_punning#Sockets_example).

<comment><USER38>
      _Alignof(max_align_t)

should be

      _Alignas(max_align_t)

or

      _Alignas(_Alignof(max_align_t))

</comment></comment></comment></comment></comment></comment></comment><comment><USER39> This could also be viewed as a comparison between two different styles of C++.

<comment><USER40> With C99 it's not that obvious. Compound literals are outside of C++ standard. However GCC for example supports them, but a bit differently [0].

      $ cat foobar.c
      #include <stdio.h>

      struct foo {
      	int x;
      	int y;
      };

      int foobar(struct foo *f)
      {
      	return f->x + f->y;
      }

      int
      main(int argc, char *argv[]) {
      	(void)argc; (void)argv;

      	printf("%d\n", foobar(&(struct foo){10, 20}));
      	return 0;
      }
      $ gcc -Wall -Wcast-align -Wextra -pedantic -std=c99 foobar.c -o foobar && ./foobar
      30
      $ g++ -Wall -Wcast-align -Wextra -pedantic foobar.c -o foobar && ./foobar
      foobar.c: In function 'int main(int, char**)':
      foobar.c:17: warning: ISO C++ forbids compound-literals
      foobar.c:17: warning: taking address of temporary
      30
      $ # taking address of temporary means that it's undefined behavior

[0] [https://gcc.gnu.org/onlinedocs/gcc/Compound- Literals.html](https://gcc.gnu.org/onlinedocs/gcc/Compound-Literals.html)

<comment><USER39> The stated he was only using the subset of C99 that could compile as C++.

</comment></comment></comment><comment><USER41> How do you avoid the need for dynamically growing arrays? For instance, if you are doing any sort of IO, you often don't know the size of the input beforehand. That either forces you to use malloc or do some strange low-level manipulations of the stack.

<comment><USER42> Or you read a fixed block at a time. This gets awkward if you need to stitch together the end of the previous block with the new one but it does have the advantage of being fast, especially if you fix the block size to the block size of the underlying filesystem (or a multiple).

<comment><USER43> +1, maybe it is because I'm not programming the most complicated things in the world, but almost all of my data structures are fixed size arrays (or are stored in them). In my experience, dynamic memory management simply isn't needed unless you are doing something very very complicated.

</comment></comment></comment><comment><USER44> The wonderful thing about C is that bad coding can't hide. The programs blow up early and loudly. In safer languages, the memory bombs go away through garbage collection / safe pointers / borrow checking / etc, but all of the uglier and quieter mistakes are still very much there.

Knuth and von Neumann took the same approach to PRNGs back in the early days...

<comment><USER45> > The programs blow up early and loudly.

Loudly, sure. Early? I wish that was the case. Heartbleed and other high- profile exploits rely on this sort of thing being able to pass unnoticed.

<comment><USER44> You got me, fair-and-square! Speaking holistically though, most of the programs I _enjoy_ using on a daily basis were written in either C or C++. Safer languages _should_ have a tremendous edge here, but the proof has not made its way into the pudding.

Just think C works as a kind of "high-pass" filter for programmers--and is _net_ positive to overall software quality. Memory issues? YMMV

</comment></comment></comment><comment><USER46> Why not C11 instead of C99? It brings even new better safety

</comment><comment><USER47> You can't learn C in an afternoon.

<comment><USER48> You can absolutely learn the syntax of C in an afternoon, or a few days at worst, if you're not having to learn to all the other concepts interesting C programs require. Much of the immense learning curve comes from th things that are "outside C", like how to synthesize high level concepts from the lower level primitives in the core language and system specific gotchas the language doesn't shield you from.

<comment><USER49> > You can absolutely learn the syntax of C in an afternoon, or a few days at > worst

That depends on what you mean by "learn".

Learn it well enough to make something that works for you, on your architecture, with your toolchain? Sure.

Learn it well enough to know which _combinations_ of the syntax you (thought you fully) learned trigger undefined and wildly variable behavior in the wild or when run with other libraries/build environments? Hell no. And bugs caused by that stuff are distressingly common.

That's not a "system specific gotcha". It's a huge area of skill-requiring behavior that arises directly _within_ the core syntax of the language.

Saying "you can learn C in a weekend" is like saying "you can learn to drive a car in a weekend" in reference to learning how to maneuver a car alone in a big empty parking lot. Technically true, but it'll leave you woefully unprepared for operating that car the way almost everyone wants to: around other cars, in more complicated contexts, subject to many more unpredictable factors (other people).

<comment><USER50> "Learn C in a weekend" (or afternoon) is akin to getting accustomed to a new model of car, _with prior driving experience_.

Each car has its own quirks, each programming language has its quirks. Learning C from the background of already knowing how to program is like driving a new Ford Focus off the lot and getting used to it.

Learning C++, on the other hand... is expecting you to pilot a jumbo jet after your only experience was the Ford Focus.

<comment><USER45> > "Learn C in a weekend" (or afternoon) is akin to getting accustomed to a new > model of car, _with prior driving experience_.

...in an empty parking lot, sure. C brings a whole host of old issues to the table that you simply do not get to experience in other languages.

C is deceptively easy to think you know, but I have yet to see evidence of someone actually using it responsibly.

</comment></comment></comment></comment></comment><comment><USER51> >> So one thing seems to be clear: yes, it's possible to write a non-trivial amount of C code that does something useful without going mad

As an embedded engineer who had written many low level code, all I had was C and assembly. I know that the higher level of abstraction you go, the amount of languages available gets bigger and bigger.

I am rather bemused that he had this impression about C. I wonder how many other tech folks has the same impression??

<comment><USER52> > I wonder how many other tech folks has the same impression??

I do! I've worked with C, C++, Python, Java, Go, JavaScript, Ruby, and Pascal, but for anything that isn't network-oriented or a simple CLI tool, I always reach for C (sometimes a strict subset of C++). Its distinct lack of features allows me to focus more on the problem at hand and less on the best of the hundred different ways to do something in other languages. Go is the same way, which is why I use it extensively for mid-level stuff like CLI tools and servers.

<comment><USER53> I've used C and Go quite a bit, and I find it a horror to write.

I end up duplicating tons of code - the exact same code copied hundreds of times across the codebase, with every time slightly different changes made to it.

How do you do custom data structures that need to parametrize over multiple types without duplication in C or Go? How do you do sane error handling without 90% of your code being if (...) { // handle error } or if err != nil { return err } ?

I mean, just read [https://git.kuschku.de/justJanne/statsbot- frontend/blob/mast...](https://git.kuschku.de/justJanne/statsbot- frontend/blob/master/main.go#L175) as example. (It's a quickly hacked-together project I wrote in about 10h)

<comment><USER54> That code can be simplified a lot if the db object stores the error itself so it can be checked only once after few calls, like what bufio.Scanner does.

<comment><USER53> That database object is from [https://golang.org/pkg/database/sql/](https://golang.org/pkg/database/sql/) which is part of the standard library of go.

</comment></comment></comment></comment></comment><comment><USER55> "It takes a lifetime to master C++"

<comment><USER56> Yeah when I see stuff like this I want to just go be a barista or something: [https://stackoverflow.com/questions/13230480/what-does- auto-...](https://stackoverflow.com/questions/13230480/what-does-auto-tell-us)

</comment></comment><comment><USER57> Why do some devs spell JavaScript and TypeScript with the incorrect casing? Not worth their time? Toy languages that aren't to be respected? Not like the rest of the post was riddled with typos to justify it.

<comment><USER58> But what did you think of the article?

</comment></comment><comment><USER59> For a small, one person project you can use absolutely any language and feel great about yourself and the language. It's like a stroll in a park - you can do it in any shoes, or even barefoot.

Where language matters are thousands or million lines of code projects, with multiple teams and people of varying experience and abilities, coming and leaving. With stupidly short deadlines and changing business requirements. With liabilities, support, maintenance, budget, time-to-market, etc.

Then it's like climbing Mt. Everest, in a snowstorm, with limited supplies and low team morale.

This whole article is just "mom look, I can walk". I come to HN to hear a "I've survived hell and here is how my shoes did" story.</comment>


EARLYCLAIM – Reserve your favorite username in new startups - <AUTHOR> http://www.producthunt.com/posts/earlyclaim

<comment><USER2> So, I signed up, but how are you dealing with sharing the login with startups? I see three options:

a) You have them hook in with you, not really ideal

b) You share the password (and salt?) weakening the security as the salt has to be shared among other companies

c) On your signup form they have a one-off contact with you to verify they are the "claimer"

Hopefully it's C. I like the idea!

<comment><USER3> we sign you up with your @earlyclaim.com email and a rendomnly generated password which you can see when you are ready to do your first "real login". For now we're lean testing with startups the open API approach and it seems welcome, but open to more ideas. What do you mean with the c) option?

<comment><USER2> Ah, okay. It was a bit late when I wrote that. I was thinking of an oAuth interface and saying "Got a username with EarlyClaim? Login here!".

<comment><USER3> :) yeah we're also looking at that as a possibility, we got a round of lean calls tomorrow w/ startups that want to get hooked in and we'll see what they tell us !

</comment></comment></comment></comment><comment><USER4> Cool idea. Does it mean new startups will have access to my email? Or will you send weekly updates to all users with a list of new startups?

<comment><USER3> naw, we want to avoid you get spammed and a messy inbox. Startups won't have access to your email. instead we'll just send you a digest email with everything. Than when you login into the startup for the first time, you can do whatever you want with your email and password (change it or leave it as is)

</comment></comment><comment><USER5> I like it.

<comment><USER3> thanks man :)</comment></comment>


Parametric pole clamp - <AUTHOR> http://www.sodnpoo.com/posts.xml/parametric_pole_clamp.xml

<comment><USER2> I love stuff like this. A member at our local hackerspace showed me a set of PVC fittings he'd printed for his grandkids that have all kinds of interesting junctions like giant K'Nex or Tinkertoys.

Someone on Reddit 3D-printed a version of Google Cardboard for their Nexus 6, but with adjustable optical distances.</comment>


Ask HN: Cybersecurity vs. Computer Science Online Masters? - <AUTHOR> I'm a new grad working in infosec with a technical non-CS degree. I have the choice between Georgia Tech's online CS MS and an online MS Cybersecurity, the best program I can get into will probably be Syracuse.<p>Cost is not an issue due to employer paying for it. Which will be best for my career advancement? <comment><USER2> Computer Science. Always choose CS over a specialisation when it comes to degrees.

The reason is that nobody expects you to really learn the tricks of the trade at university, those are learnt on your own time and on the job. Universities are for education, not technical skill.</comment>


We're opening expaflyr for beta-access. Feedback appreciated - <AUTHOR> http://beta.expaflyr.com/NzI

<comment><USER2> Congrats on getting to beta.

Off the bat: 1st page seemed opaque; didn't state what the product does. _"promote and spread through social media and networks"_

Spread what? Social media are types of networks and networks itself is a generic term used as suffix to have any meaning. Using both "promote" and "spread" is also redundant as they mean the same thing. I normally would have exited the site at this point.

On inside page, the example flyers I saw were pictures with titles only, no additional info, which do not constitute flyers to me. Nice pictures though.</comment>


New TSA Policy May Lead to Increased Scrutiny of Reading Material - <AUTHOR> https://www.aclu.org/blog/free-future/new-tsa-policy-may-lead-increased-scrutiny-reading-material <comment><USER2> A decade ago, before the war in Syria, I hitchhiked from Europe to Egypt for my winter holiday. When I was at the Jordan-Israel border, I got a little extra scrutiny from the Israeli officials, because I had -- besides passport stamps from some hostile countries -- in my backpack some textbooks for Kazakh and Tatar linked to my university studies at the time, and the latter had a picture of Kazan's main mosque on the cover. And yet, the official seemed quite knowledgeable about these things, and realized that loads of people interested in Central Asian area studies would have books like that and that didn't mean they had any interest in Islam etc. So, we chatted about that and Russian/CIS politics for some time and then I was let through. The Israelis must have been carefully observing my body language etc. according to their security policy, but still everything was quite friendly and reasonable.

But I doubt that most American officials would ever be so informed about the outside world and reasonable. The last time I visited the US, I was asked about a Kazakh visa in my passport in so harsh a tone it sounded like a reprimand for just having one at all (and in spite of the name ending in -stan, Kazakhstan is generally about one of the most secular countries in Eurasia). And if border control staff don't know anything, one can only expect the worst from the TSA, a job that requires almost no qualifications.

<comment><USER3> > Kazakhstan is generally about one of the most secular countries in Eurasia)

Presumably this is one reason why Sacha Baron Cohen chose Kazakhstan to be Borat's hometown - if he had picked an Islamic country he'd be risking a beheading in the streets of London.

<comment><USER2> He chose Kazakhstan because he was unlikely to meet anyone who knew about Kazakhstan or was from Kazakhstan. Originally the Borat character was an Albanian named Christo, but there were too many Albanians coming to London by the late 1990s.

<comment><USER4> I wonder why he didn't use a fictional country? That would insure that he wouldn't meet anyone from there. He could even pick one that has been used before, and put a couple references to that prior use, to give fans a bit of trivia to notice.

For example, use Franistan, and have a reference to the Maharincess of Franistan's 1952 visit to New York.

<comment><USER5> You lose part of the comedy value. As with his latest "Brothers Grimsby" or with "Brüno" and all the way to Ali G, Baron-Cohen likes to root his comedy in geographically-defined stereotypes. Occasionally the result latches on somewhat universal figures, but from the beginning it relies on viewers sharing Sacha's prejudices on this or that geographically-defined subculture.

</comment></comment></comment></comment></comment><comment><USER6> TSA Top Ten books

1\. Idiots Guide to Flying [https://www.amazon.com/Complete-Idiots-Guide- Flying-Gliding/...](https://www.amazon.com/Complete-Idiots-Guide-Flying- Gliding/dp/0028638859)

2\. The Qur'an [https://www.bookdepository.com/The-Koran-John-Medows- Rodwell...](https://www.bookdepository.com/The-Koran-John-Medows- Rodwell/9780553587524?ref=grid-view&qid=1498396568992&sr=1-2)

3\. A Handbook on Modern Explosives [https://archive.org/details/ahandbookonmode00eissgoog](https://archive.org/details/ahandbookonmode00eissgoog)

4\. Dabiq or Rumiyah (Daesh magazine) [https://clarionproject.org/islamic- state-isis-isil-propagand...](https://clarionproject.org/islamic-state-isis- isil-propaganda-magazine-dabiq-50/) [Don't click this link! [https://azelin.files.wordpress.com/2016/07/the-islamic- state...](https://azelin.files.wordpress.com/2016/07/the-islamic- state-e2809cdacc84biq-magazine-1522.pdf) ]

5\. 1984 [https://www.audible.com/pd/Classics/1984-Audiobook/B002V19RO...](https://www.audible.com/pd/Classics/1984-Audiobook/B002V19RO6?ipRedirectOverride=true)

Help me out with 6-10 people.

<comment><USER6> All good suggestions. But, pthreads, they are unlikely to detect the satire in bringing Art of the Deal, and are more likely to be reassured than concerned. In fact, I expect all Jihadis to be carrying tAotD already.

Forgot to engage karma shields though and the anti-humor brigade is out in force! The book burners of HN!

</comment></comment><comment><USER7> No fan of the TSA, but this is a reach. There was another (better) article about this explaining that tightly packed books appear on x-ray scans as big solid opaque blobs. This makes it difficult to distinguish them from chemical material.

The TSA has 1001 ways to harass you for whatever they want, and that sucks. This won't make that situation any better. That said, I'm tired of "speculative journalism" pieces that attempt to paint the worst possible scenario imaginable in order to raise people's fear level or (in this case perhaps) to gin up donations from supporters.

<comment><USER8> The point is not that the TSA wants to or even ever will use your reading material against you in some way.

The point is the slow and steady erosion of privacy rights one tiny inch at a time.

In the far future when a government DOES decide to use these things against its people, they will have no defense against it because the practice has become a long accepted fact of life.

<comment><USER7> I do agree with the ACLU's mission and with the notion that privacy rights are being eroded. At the same time, I personally feel that this kind of polemic is becoming so common that its usage risks numbing us to the biggest risks. (If everything is an emergency, then nothing is.) Criticism is possible without relying on cheap speculation and exaggeration.

</comment></comment></comment><comment><USER9> A friend of mine had quite the adventure when she was detained for no reason even though she had entered before just fine and was a university student.

Even though I am a citizen of a "safe" "first-world" European country and having visited USA in the past with barely any issue, I now try to not visit friends there due to these policies and behavior, but rather I convince those that can to meet me either on Canada or Mexico.

It's really sad what it has come down to.

<comment><USER10> I think you have fallen victim to the news. Yes there are a lot of rumblings about things like the OP, but the vast majority of people pass through US customs with no issue. Even as you said. Last time I went to Mexico both my gf and I were searched. When I landed in Brussels last time the immigration officer was really rude to me for no reason. It's not unique to the United States. My view is that your comment, like many other similar comments, are more so about venting outrage at Trump and so this is a convenient straw man (despite the fact that these kinds of policies continued under Obamacare). I'm not saying there aren't horror stories, but they are very few and far between, and much more publicized than getting detained in Thailand for a day because you didn't pay off the customs officer (contrived example). The US is the big target, so everything is exaggerated. I've heard people from Europe say they wouldn't visit the US because they fear for their lives and other things like that too, but again that's because they heard about a school shooting and then assumed New York was a battleground.

<comment><USER11> > I think you have fallen victim to the news.

I've experienced these problems first hand. US immigration being incredibly rude to visitors for no reason at all, and know someone from London who was sent to secondary because they were the wrong skin color (their electronic devices searched, books read, and seemingly no clear answer as to why, it was a business trip with a return ticket to a conference they had a ticket for and hotel room booked for).

I genuinely wish Americans could experience US immigration as a foreigner; rather than get their special lines where they just get waved through. Then things would change, things would change rapidly.

How many times, online, do Americans need to read that US immigration is some of the worst in the world before you'll believe it? That your border feels like entering a police state? Seriously, what will it take? The fact that you guys are now attributing it to "fake news" says a lot.

News stories are fake, anecdotes are fake, it is all fake because you don't like to hear it...

PS - US immigration has been horrible since at least 9/11 (arguably it was bad before). This has nothing to do with Trump, it was horrible under Obama and W. Bush too.

<comment><USER10> Yeah idk. Every country I've been to, customs has not been great. I'm. not saying the US immigration isn't bad, but people actively avoiding the entire country for anything bad? Not hardly.

<comment><USER12> Well I have some anecdata for you. I personally know three people who have cancelled subsequent trips to the USA after their treatment on entry, and I personally will not be coming back after the way I was treated. I've travelled on business to over 30 countries, and thus is the first time I've decided that a particular one is just not worth the hassle.

So you keep believing everything is ok, I'm sure it makes you feel better, rather than actually listening to other people's stories.

<comment><USER10> And yet, many people I know who have immigrated here, whether on work or student visas, have had no issues at the border.

So.... I'm not sure what to tell you. What exact treatment happened? Somebody being rude to you at the border doesn't count, who cares about that? If you were detained, or interrogated, or something along those lines, then yeah you have a legitimate gripe. But I don't want to hear anything about "the security officer was rude".

<comment><USER12> You claim that people are not avoiding the country because of treatment received at immigration. I'm telling you that I know people who are avoiding the country, and I'm one of them.

Don't tell me what I am and am not allowed to feel based on my experience.

<comment><USER10> Nobody says you can't feel anything. And nobody says that some people aren't avoiding the US because of how they were treated at immigration. What I am saying is that the vast majority of people have no problem.

What was your poor experience?

</comment></comment></comment></comment></comment></comment></comment></comment><comment><USER13> Seems like a better way to find out about reading habits would be to tap into the internet and track a bunch of meta data about people... oh, wait

<comment><USER14> "Sir, I'm going to need your Goodreads and public library login credentials."

</comment></comment><comment><USER15> I recently had TSA look at my carryon closely. I had a spiral notebook, folder thick with papers, and a paperback copy of Gravitys Rainbow.

The agent pointed out the scan and how the thickness of the paper, combined with all my charging cords, made it hard to detect what my bag contained.

He pulled the items out and looked thumbed the pages quickly; not reading just looking for anything obvious. Then I was on my way.

I hate TSA as much as the next guy, but sometimes there isn't some malicious infingement of privacy in mind.

<comment><USER16> Yes, there is just blatant, mindlessly ineffective infringement of privacy.

</comment></comment><comment><USER17> Well ... there it is, if there was a threshold to past between "security" and overreaching destruction of freedoms, it's been passed. They sortof had a case banning various things that can hold explosives but banning certain reading material for being "sensitive" is totally orwellian. I guess the time has come to preserve all information before they start the book burning in the not too distant future. (of course it will come under a different guise but it will be book burning)

<comment><USER18> Nothing of the sort is described, or even suggested, in the article.

</comment></comment><comment><USER19> Talk about your slippery slopes.

<comment><USER20> The USA is at the bottom of the slippery slope, has landed on it's arse and now rapidly sinks deeper in to the quagmire.

 _For example, in 2010 the ACLU sued on behalf of a man who was abusively interrogated, handcuffed, and detained for nearly five hours because he was carrying a set of Arabic-language flash cards and a book critical of U.S. foreign policy. We also know that the DHS database known as the "Automated Targeting System," which tracks information on international travelers, has included notations in travelers' permanent files about controversial books in their possession._

<comment><USER21> The flash cards case was not as clear cut as one would think:

> The flashcards included every day words and phrases such as "day before > yesterday," "fat," "thin," "really," "nice," "sad," "cheap," "summer," > "pink," and "friendly."

> However, they also contained such words as: "bomb," "terrorist," > "explosion," "attack," "battle," "kill," "to target," "to kidnap," and "to > wound."

[http://www2.ca3.uscourts.gov/opinarch/114292p.pdf](http://www2.ca3.uscourts.gov/opinarch/114292p.pdf)

<comment><USER20> Crikey! Remind me not to invite you to parties. They're just _words_. Probably pretty dumb ones to take through airport security, but then it would be hard to find an action / thriller novel that didn't contain some or all of those words many times over. Or as the sibling comment points out any _newspaper_.

You want a more egregious, what about detaining little old ladies in wheelchairs and children's book authors? [https://www.theguardian.com/commentisfree/2017/feb/28/in- tha...](https://www.theguardian.com/commentisfree/2017/feb/28/in-that-moment- i-loathed-america-i-loathed-the-entire-country)

</comment></comment></comment></comment><comment><USER22> I don't think my paperback is going to take down a plane

<comment><USER14> From the post:

> The second justification is to search for something called "sheet > explosives," which are apparently thin, flat explosives that can be hidden > within sheafs of paper or photographs. In a case decided by the 9th Circuit > in 2011, a man was arrested after TSA screeners found child pornography in > his checked baggage, and while a district court ruled that the agency's > search of a stack of the man's photographs was invalid, the 9th Circuit > reversed, in the process accepting as justification the need to check for > sheet explosives.

<comment><USER22> An A4 sheet is like 5 grams.

Sure it's not impossible but I suspect the crooks can dream up something easier.

</comment></comment></comment><comment><USER23> I have consciously not carried "The Monkeywrench Gang" on a plane, even if I was in the middle of reading it at the time.

<comment><USER24> Ditto for a book on the history and manufacture of nitroglycerine. It's fascinating, but I didn't want to try to explain my interest in the subject. I've also worried about carrying printed material obviously related to malware (e.g., "The Big Black Book of <whatever>").

Chilling effects, yeah.

</comment></comment><comment><USER25> As they say... Knowledge is power!</comment>


Paradox of Tolerance - <AUTHOR> https://en.wikipedia.org/wiki/Paradox_of_tolerance <comment><USER2> The best essay I've seen on this "paradox" is by Yonatan Zunger: [https://extranewsfeed.com/tolerance-is-not-a-moral- precept-1...](https://extranewsfeed.com/tolerance-is-not-a-moral- precept-1af7007d6376)

An excerpt:

> Tolerance is not a moral absolute; it is a peace treaty. Tolerance is a > social norm because it allows different people to live side-by-side without > being at each other's throats.

Note the full essay is well worth reading.

</comment><comment><USER3> Citing this "paradox" is a great way to shut down discussion by claiming the other person is being intolerant. Basically the only time I've ever seen this invoked is on Reddit in a dishonest way.

<comment><USER4> I've only ever invoked it against neo-neo-Nazis and conspiracy theorists demanding to be taken seriously.

Would you call that dishonest?

<comment><USER5> Yes, because the dishonest part is the how often those labels are thrown around with no real basis.

<comment><USER6> I've seen it used against people spouting QAnon, Big Pharma mind control vaccine theories and support for fascist elements of various governments like USA, China, Turkey, Russia, and Poland. Seems appropriate to me. It's not healthy to tolerate these folks, especially the fascists.

</comment></comment></comment></comment><comment><USER7> The word "intolerant" has an implied "of [x]" — when progressives use the term the implied bit is usually "of minorities," or "of trans people," "of women in tech" or something like that. When I call Trump "intolerant," that's generally what I mean, for example.

But of course one can try to be very tolerant about those things and still be "intolerant." I'm intolerant of poison. Just don't like it! I'm intolerant of manipulative assholes. I'm intolerant of people who greedily ignore the health and safety of those around them. Etc.

Some people are very invested in everyone forgetting the "of [x]" bit that comes after "intolerant" because it allows them to make the argument that society has to accept them no matter how horribly they behave. It does not.

<comment><USER8> Society is defined to similar values where they can drive progress towards a common goal, when values diverge completely where some say family construct is no more valid and should be abolished and others see it as central construct for a healthy society to exist and 'tolerance/intolerance' there is no society anymore.

Open minds and progress forward(in minds) what defines a healthy society, delineation a thin line between tolerance/intolerance - where war is already lost, openness and freedom to discuss any ideas is where progress is made.

This is what it was in soviet russia and politburo dispensing viewpoints anyone having any other ideas was to be force-reeducated. Anyone doing too well etc. etc.

</comment></comment><comment><USER9> The only time I've seen someone bring this up in real life is to shut down someone else they disagree with.

</comment><comment><USER10> Tolerance is not a good thing. If you see something which you think isn't right you should speak up and not just tolerate it. It's weird that tolerance is connected with the peaceful coexistence of two groups of people. As if this was the only way. People coexist peacefully because it's the reasonable thing to do, not because they exercise tolerance.

<comment><USER11> Sometimes people coexist peacefully despite thinking the other person is wrong. Sometimes speaking up about things you think are wrong precludes peaceful coexistence, and in those cases, peaceful coexistence is indeed the exercise of tolerance.

<comment><USER10> I think the latter case is not a solution to the problem, but rather a form of procrastination. Instead of trying figure out how to resolve the issues in a peaceful way, you declare peace and hope for the best. Doesn't work in the long run. Of course you can buy time by declaring peace to figure things out and for that tolerance is useful, but it is certainly not the most important thing that assures peaceful coexistence. Any peace it would bring is too fragile. Reason gives you permanent peace.</comment></comment></comment>


The first Tesla Model S has crashed - held up really well, no injuries - <AUTHOR> http://www.vcstar.com/news/2013/mar/29/woman-crashes-new-car-into-camarillo-restaurant/

<comment><USER2> Why don't old people understand that the brakes don't make the car go forward?

They always claim they hit the brake and never say "I thought I hit the brakes, but must have hit the gas."</comment>


In 'Undeniable,' Bill Nye Speaks Evolution Directly to Creationists - <AUTHOR> http://www.nytimes.com/2014/11/04/science/in-undeniable-bill-nye-speaks-evolution-directly-to-creationists.html?action=click&pgtype=Homepage&version=Moth-Visible&module=inside-nyt-region&region=inside-nyt-region&WT.nav=inside-nyt-region <comment><USER2> If Bill Nye is so smart, why does he waste so much time trying to convince people of something they don't want to be convinced about? Seems like an effort sink.

<comment><AUTHOR> I think it is effort well spent. He has a platform and he's passionate about educating people on the subjects of specific theories in science and the scientific process, and he's very good at it. Of course part of his audience has their fingers in their ears, but the reason it's not a waste of time is that there are always a few people in these communities, especially young people, who are not yet immune to reason.</comment></comment>


'Rick and Morty' Tests Rick's Atheism by Breaking Time Itself - <AUTHOR> https://www.inverse.com/article/48992-rick-and-morty-season-2-premiere-reveals-how-rick-feels-about-god <comment><USER2> Great show!</comment>