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

C modules

Name: Anonymous 2012-11-26 12:21

Name: Anonymous 2012-11-26 12:35

Looks good. You can say anything you want about Apple or call me a macfag, but LLVM/Clang is very good, and since Apple bought them they've released very interesting things. Their C++ compilers are second to none. And the Objective-C ARC is much better than any garbage collection shit.

Name: Anonymous 2012-11-26 12:46

>>2
thinking obj-c is anything but shit
Stay macfag, macfags.

Name: Anonymous 2012-11-26 12:46

How will they improve template inclusion?

Name: Anonymous 2012-11-26 12:51

C has problems, but they're only just deciding to fix them 35+ years later? What's the point?

Name: Anonymous 2012-11-26 12:58

>>4
i'm not sure the template problem can be fixed without resorting to the existing hacks for forcing instantiation for specific types because of the whole single-pass compilation model bullshit. part of the problem is templates instantiated in TU AAA have no knowledge of template implementation in TU BBB, further TU BBB has no idea _what_ template implementations need to be generated to satisfy TU AAA. as i said above this can be somewhat alleviated by forcing instantiation for specific types in TU BBB. i guess some sort of crazy build hackery could be done to build object files, find all the template symbols in there, build a common header file that has a typelist and use some metaprogramming that all your template stuff includes to automagically force instantiation so everything is there at link time. actually that sounds really fun.

Name: Anonymous 2012-11-26 13:17

Objective C isn't the same thing as C.

Name: Anonymous 2012-11-26 13:35

>>7
That PDF refers to the the entire family of C languages, so I guess they'll bring it to C, C++ and Objective-C.

Name: Anonymous 2012-11-27 22:51

I don't appreciate how the author dismisses precompiled headers, then introduces a header-to-module mapping tool suffers from all of the same limitations.  It seems to me that using a tool assist with managing header dependencies in conjunction with PCH will solve 80-90% of the problems this module mechanism attempts to solve.

It's also not clear to me how the modularized code gets transformed to a format that the native linker cannot understand.  Systems programmers are not going to use modules if it means using LLVM's linker.

Name: >>9 2012-11-27 22:57

>>9
s/tool assist/tool to assist/;s/native linker cannot understand/native linker can understand/

Time for bed.

Name: Anonymous 2012-11-28 7:35

Can we make any program in c++ without using any header file and what is the shortest program in c++?  What is difference b/w private and pubic inheritance?

Name: Anonymous 2012-11-28 9:01

>>9
The header-to-module mapping is only intended for compatibility during the transitional period. If the code is written using modules it's not needed.

Modules have no impact on the produced object files, so I have no idea what the fuck you are on about there.

Name: Anonymous 2012-11-28 9:38

ObjC has modules and javashit does not.  Ha ha

Name: Anonymous 2012-11-28 10:46

>>12
Modules have no impact on the produced object files, so I have no idea what the fuck you are on about there.

The slide deck goes on about how using modules will reduce the effort needed during the link phase by eliminating the duplicate debug info produced by conventional preprocessing (slide 83).  How is this supposed to work if the object files do not change?

Name: Anonymous 2012-11-28 11:05

>>14
It doesn't produce the duplicated debug info in the first place, so there's less work for the linker to do. Requires no changes to the linker.

Name: Anonymous 2012-11-28 11:33

I'm not sure if I get this correctly here, but:
M x N build cost
Precompiled headers are a terrible solution
...isn't he lying straight out about this?
And what about #pragma once / compiler-side include-guard optimization? -- He never seems to have heard about this either...
Also, which giant retard aliases FILE, min, max or something similar? I know it's just a bad example but unless he gives a good example that's just not an argument.
Seriously, he gives the cheapest arguments against the current link system just to encourage future dependency on shitty tools. What the fuck.

Name: Anonymous 2012-11-28 12:07

>>16
Even with include guards you still need to open and parse the header every time it's #included - you can just do it a bit quicker. And if you've ever tried to integrate large code bases from different sources you know those are unfortunately not bad examples. (Windows system headers seem to work especially hard to cause collisions)

Name: Anonymous 2012-11-28 12:47

>>17
I don't get it. In modern times this really shouldn't be an issue, see:

http://www.bobarcher.org/software/include/index.html
If the internal include guard optimisation is implemented this will compile quickly because the header file will only have to be opened once (as in the external include guard case). [...]

http://en.wikipedia.org/wiki/Pragma_once
Common compilers such as GCC, Clang, and EDG-based compilers include special speedup code to recognize and optimize the handling of include guards, [...]

Name: Anonymous 2012-11-28 13:32

>>16
#pragma once
Having to use #pragma once is ugly and non-standard. It's like the header guards. C was invented in a time when compilers and programming languages were much less sophisticated, and now it's time to fix some things that were fixable a long time ago, instead of inventing completely new languages like Go.
which giant retard aliases FILE, min, max or something similar
Tell me which part of the C/C++ standard says that I can't define names called "FILE", "min" or "max". And these are just some examples, there are millions of possible name collisions depending of what you include.
future dependency on shitty tools
Are you saying that Clang is shit? It's much better than GCC.

Besides that, modules can make compilation (and least when debugging code generation is on) much faster, and fix the current clusterfuck that are templates in C++. And please don't tell me "what giant retard uses templates in C++".

Name: Anonymous 2012-11-28 14:21

>>19
I'm not saying #pragma once should be used, I don't use it myself, either. I just think that (conditional) #include is all you mostly need. Especially since it can be optimized by the compiler. There's just no need in fixing a working system.
Tell me which part of the C/C++ standard says that I can't define names called "FILE"
Well, the ISO C standard for example, Section 7. Granted, min/max isn't specified AFAIK. But seriously now, it's just common sense not to deliberately try to provoke name clashes.
Are you saying that Clang is shit? It's much better than GCC.
At the moment, this is mostly a personal opinion. But when there are bagillions of addons like this exclusive to Clang which hinder portability you might as well be dependant on really shitty tools/environments. And then #import will be the same as #pragma once:
ugly and non-standard

About C++ I can't really say much, there might be a point in what you say about it, as I only have shallow knowledge about templates.

Name: Anonymous 2012-11-28 15:33

using include guards at all
Stay cargo-cult.

Name: Anonymous 2012-11-28 16:02

>>20
The compiler is invoked once per source file. Include guards does not help in this case. PCH are a frangile fragile and ugly hack. Name collisions are depressingly common. Slightly less with C++ if namespaces are used, but even then there's always some cock who sticks using directives everywhere.

A working implementation is a first step towards getting a feature included in the language standard.

Name: Anonymous 2012-11-28 16:10

>>19
Are you saying that Clang is shit?
Are you saying it isn't?

Name: Anonymous 2012-11-28 17:09

>>23
It's good, as far as C/C++/Objective-C compilers are concerned.

Name: Anonymous 2012-11-28 17:35

>>24
It's written in C++.

Name: Anonymous 2012-11-28 17:38

>>23
Yes.

Name: Anonymous 2012-11-28 17:46

>>25
The rule rather than the exception for modern compilers.

Name: Anonymous 2012-11-28 18:42

>>19
Clang is a steaming pile of shit

So is C++

So is C

Name: Anonymous 2012-11-28 18:52

>>28
>LE GRO FACE

Name: Anonymous 2012-11-29 0:06

>>15
At the very least, wouldn't one have to do a pass to compile debug info for all modularized code and tell the native linker to use it?  The information in the headers can't just be thrown away.

Incidentally, gcc 4 already has the capability to deduplicate some of DWARF information at the compile phase [1].

>>21
I've often thought of doing something like this, to make it easier to spot bad header dependencies:

#ifdef FOO_H
#error multiple includes
#else
#define FOO_H
/* ... */
#endif


In practice, though, it seems that once the number of headers exceeds 10-20, people become unwilling or unable to keep the includes in topographical order.


[1] http://gcc.gnu.org/wiki/DwarfSeparateTypeInfo

Name: Anonymous 2012-11-29 7:59

>>27
As C++ was admitted into compilers' source code, compilers grew exponentially worse!

Name: Anonymous 2012-11-29 8:14

>>30
Wow, it is getting deep in here

Name: Anonymous 2012-11-29 8:51

>>30
Why is this so difficult to understand? The only thing that changes is that there's less work generated for the linker to deal with. Debug info is created only in the object file for the module that defined it, because header files don't exist aymore to spread their crap around.

The GCC hack is an example of a solution that does require toolchain modifications to handle the new sections and attribute types.

Name: Anonymous 2012-11-29 9:17

>>30
Ever heard the word "cross edge"?

Name: Anonymous 2012-11-29 9:21

>>31
Rip and tear your stack!  You are a C++ program, which means you have huge stack!  Rip and tear!

Name: Anonymous 2012-11-29 9:23

>>21
I can easily have two headers that I want to silently include the same header.

Name: Anonymous 2012-11-29 10:16

>>36
You shouldn't be including in headers.

Name: Anonymous 2012-11-29 10:19

>>37
Better way to achieve modularity?

Name: Anonymous 2012-11-29 10:22

>>38
What?

Name: Anonymous 2012-11-29 11:07

>>37
Every header should be parseable without errors.

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