Originally posted by coder
View Post
Announcement
Collapse
No announcement yet.
Coroutines & Modules Added For C++20
Collapse
X
-
-
Originally posted by cj.wijtmans View Post
so you cant import a module? the compiler should be able to use the same information that a header contains (except for macros and certain templates but those shouldnt exist in C++ anyway)
Modules are imported almost like headers are, but unlike headers they don't ship macros.
Leave a comment:
-
Originally posted by atomsymbolI still think the requirement of knowing sizeof(T) and alignof(T)
Originally posted by atomsymbolInvoking T's default constructor, destructor, assignment operator, or copy-constructor: These are plain function calls, unless inlining. Default constructor/etc are automatically marked as inline by current compilers - a current-compiler-specific feature.
Leave a comment:
-
Regarding modules: Apart from those who just want modules to improve build speeds, there are also those who dream of shipping binary "modules" rather than libraries + source header files because they dislike open source as a business model, and hope that "modules" will be easier to ship without lots of source code in lengthy header files. Only time will tell how often this feature will be used an abused. And whether compiler makers will succeed to let modules actually work faster and more flexible than "pre-compiled headers".
- Likes 1
Leave a comment:
-
Originally posted by atomsymbol[I]C++ forces the programmer to define types of fields of a struct/class before the struct/class is defined. This is putting a very strict constraint on the ordering of struct data types in the source code. You cannot call a virtual method (defined elsewhere !!!) before the struct definition has seen the definition of the types of its fields, while obviously the knowledge of fields is immaterial to the virtual method call.
- Likes 2
Leave a comment:
-
Originally posted by atomsymbolExactly.
- Likes 1
Leave a comment:
-
Originally posted by atomsymbolAn imaginary compiler could postpone global&static&stack allocations to link time
Originally posted by atomsymbolPassing T by value: This case can be reduced to allocation of sizeof(T) bytes followed by invocation of the copy-constructor.
Originally posted by atomsymbolInvoking T's default constructor, destructor, assignment operator, or copy-constructor: These are plain function calls, unless inlining.
Originally posted by atomsymbolDefault constructor/etc are automatically marked as inline by current compilers - a current-compiler-specific feature.
Originally posted by atomsymbolnew T(): This is a call to function "T* new_T()" created by the compiler in the single .cc file that can see the field types and thus knows sizeof(T).
- Likes 2
Leave a comment:
-
Originally posted by atomsymbolTrue, although the PImpl pattern require the programmer to define an extra class which would be unnecessary in some cases if the language&compiler allowed usage of classes (method calls) without knowledge of field types.
Originally posted by atomsymbolAbstract interfaces still require #include directives due to instantiation via operator new of interface implementations, which is unnecessary because the invoking the constructor+operator_new does not need the caller to know the representation of class's fields.Last edited by pal666; 25 February 2019, 06:51 PM.
- Likes 1
Leave a comment:
-
Originally posted by atomsymbolWhy should it matter what you think about the idea of superfluous C++ #includes/import to me? Or do you happen to be implementing a compiler?
- Likes 2
Leave a comment:
Leave a comment: