macos-buildscripts | build Graal , loom , llvm , swift , etc using Xcode | Compiler library
kandi X-RAY | macos-buildscripts Summary
kandi X-RAY | macos-buildscripts Summary
scripts to build Graal, loom, llvm, swift, etc using Xcode and no other tools
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of macos-buildscripts
macos-buildscripts Key Features
macos-buildscripts Examples and Code Snippets
Community Discussions
Trending Discussions on Compiler
QUESTION
I have newly installed
...ANSWER
Answered 2021-Jul-28 at 07:22You are running the project via Java 1.8 and add the --add-opens
option to the runner. However Java 1.8 does not support it.
So, the first option is to use Java 11 to run the project, as Java 11 can recognize this VM option.
Another solution is to find a place where --add-opens
is added and remove it.
Check Run configuration in IntelliJ IDEA (VM options field) and Maven/Gradle configuration files for argLine
(Maven) and jvmArgs
(Gradle)
QUESTION
After coming across something similar in a co-worker's code, I'm having trouble understanding why/how this code executes without compiler warnings or errors.
...ANSWER
Answered 2022-Feb-09 at 07:17References can't bind to objects with different type directly. Given const int& s = u;
, u
is implicitly converted to int
firstly, which is a temporary, a brand-new object and then s
binds to the temporary int
. (Lvalue-references to const
(and rvalue-references) could bind to temporaries.) The lifetime of the temporary is prolonged to the lifetime of s
, i.e. it'll be destroyed when get out of main
.
QUESTION
In the following example function f()
returning incomplete type A
is marked as deleted:
ANSWER
Answered 2021-Dec-19 at 10:26Clang is wrong.
[dcl.fct.def.general]
2 The type of a parameter or the return type for a function definition shall not be a (possibly cv-qualified) class type that is incomplete or abstract within the function body unless the function is deleted ([dcl.fct.def.delete]).
That's pretty clear I think. A deleted definition allows for an incomplete class type. It's not like the function can actually be called in a well-formed program, or the body is actually using the incomplete type in some way. The function is a placeholder to signify an invalid result to overload resolution.
Granted, the parameter types are more interesting in the case of actual overload resolution (and the return type can be anything), but there is no reason to restrict the return type into being complete here either.
QUESTION
Why does the TypeScript compiler compile its optional chaining and null-coalescing operators, ?.
and ??
, to
ANSWER
Answered 2021-Nov-04 at 17:40You can find an authoritative answer in microsoft/TypeScript#16 (wow, an old one); it is specifically explained in this comment:
That's because of
document.all
[...], a quirk that gets special treatment in the language for backwards compatibility.
QUESTION
In short:
I have implemented a simple (multi-key) hash table with buckets (containing several elements) that exactly fit a cacheline. Inserting into a cacheline bucket is very simple, and the critical part of the main loop.
I have implemented three versions that produce the same outcome and should behave the same.
The mystery
However, I'm seeing wild performance differences by a surprisingly large factor 3, despite all versions having the exact same cacheline access pattern and resulting in identical hash table data.
The best implementation insert_ok
suffers around a factor 3 slow down compared to insert_bad
& insert_alt
on my CPU (i7-7700HQ).
One variant insert_bad is a simple modification of insert_ok
that adds an extra unnecessary linear search within the cacheline to find the position to write to (which it already knows) and does not suffer this x3 slow down.
The exact same executable shows insert_ok
a factor 1.6 faster compared to insert_bad
& insert_alt
on other CPUs (AMD 5950X (Zen 3), Intel i7-11800H (Tiger Lake)).
ANSWER
Answered 2021-Oct-25 at 22:53The TLDR is that loads which miss all levels of the TLB (and so require a page walk) and which are separated by address unknown stores can't execute in parallel, i.e., the loads are serialized and the memory level parallelism (MLP) factor is capped at 1. Effectively, the stores fence the loads, much as lfence
would.
The slow version of your insert function results in this scenario, while the other two don't (the store address is known). For large region sizes the memory access pattern dominates, and the performance is almost directly related to the MLP: the fast versions can overlap load misses and get an MLP of about 3, resulting in a 3x speedup (and the narrower reproduction case we discuss below can show more than a 10x difference on Skylake).
The underlying reason seems to be that the Skylake processor tries to maintain page-table coherence, which is not required by the specification but can work around bugs in software.
The DetailsFor those who are interested, we'll dig into the details of what's going on.
I could reproduce the problem immediately on my Skylake i7-6700HQ machine, and by stripping out extraneous parts we can reduce the original hash insert benchmark to this simple loop, which exhibits the same issue:
QUESTION
If one defines a new variable in C++, then the name of the variable can be used in the initialization expression, for example:
...ANSWER
Answered 2021-Oct-06 at 22:12According to the C++17 standard (11.3.6 Default arguments)
9 A default argument is evaluated each time the function is called with no argument for the corresponding parameter. A parameter shall not appear as a potentially-evaluated expression in a default argument. Parameters of a function declared before a default argument are in scope and can hide namespace and class member name
It provides the following example:
QUESTION
I am trying to run a project on the Xcode13, after running a pod cache clean --all, deleting the derived data, and running a pod update. When I clean the project and build it the following error appears:
...ANSWER
Answered 2021-Oct-05 at 16:33Edited: For people who use Cocoapods, this answer might be useful: https://stackoverflow.com/a/69384358/587609
I also faced this issue, and it seems that there is a known issue on Xcode 13 as mentioned in this document: https://developer.apple.com/documentation/Xcode-Release-Notes/xcode-13-release-notes
Swift libraries depending on Combine may fail to build for targets including armv7 and i386 architectures. (82183186, 82189214)
Workaround: Use an updated version of the library that isn’t impacted (if available) or remove armv7 and i386 support (for example, increase the deployment target of the library to iOS 11 or higher).
If your app is for iOS 11 or higher, one of the libraries should be modified to target iOS 11 or higher (e.g., my app is for iOS 12 or higher).
For example, I am using GRDB.swift, and its minimum iOS version is 10.0. There was a discussion as an issue of this repo, and I followed that comment to solve this issue as follows:
- Fork the repository
- Change Package.swift to modify the minimum iOS version like:
QUESTION
Consider the following C++17 code:
...ANSWER
Answered 2021-Oct-03 at 12:09The code shown is valid (all C++ Standard versions, I believe). The similar restrictions are all listed in [reserved.names]. Since read
is not declared in the C++ standard library, nor in the C standard library, nor in older versions of the standard libraries, and is not otherwise listed there, it's fair game as a name in the global namespace.
So is it an implementation defect that it won't link with -static
? (Not a "compiler bug" - the compiler piece of the toolchain is fine, and there's nothing forbidding a warning on valid code.) It does at least work with default settings (though because of how the GNU linker doesn't mind duplicated symbols in an unused object of a dynamic library), and one could argue that's all that's needed for Standard compliance.
We also have at [intro.compliance]/8
A conforming implementation may have extensions (including additional library functions), provided they do not alter the behavior of any well-formed program. Implementations are required to diagnose programs that use such extensions that are ill-formed according to this International Standard. Having done so, however, they can compile and execute such programs.
We can consider POSIX functions such an extension. This is intentionally vague on when or how such extensions are enabled. The g++ driver of the GCC toolset links a number of libraries by default, and we can consider that as adding not only the availability of non-standard #include
headers but also adding additional translation units to the program. In theory, different arguments to the g++ driver might make it work without the underlying link step using libc.so
. But good luck - one could argue it's a problem that there's no simple way to link only names from the C++ and C standard libraries without including other unreserved names.
(Does not altering a well-formed program even mean that an implementation extension can't use non-reserved names for the additional libraries? I hope not, but I could see a strict reading implying that.)
So I haven't claimed a definitive answer to the question, but the practical situation is unlikely to change, and a Standard Defect Report would in my opinion be more nit-picking than a useful clarification.
QUESTION
#include
int main() {
char a = 5;
char b[2] = "hi"; // No explicit room for `\0`.
char c = 6;
return 0;
}
...ANSWER
Answered 2021-Sep-13 at 12:35It is allowed to initialize a char
array with a string if the array is at least large enough to hold all of the characters in the string besides the null terminator.
This is detailed in section 6.7.9p14 of the C standard:
An array of character type may be initialized by a character string literal or UTF−8 string literal, optionally enclosed in braces. Successive bytes of the string literal (including the terminating null character if there is room or if the array is of unknown size) initialize the elements of the array.
However, this also means that you can't treat the array as a string since it's not null terminated. So as written, since you're not performing any string operations on b
, your code is fine.
What you can't do is initialize with a string that's too long, i.e.:
QUESTION
I've been writing C++ for many years, using nullptr
for null pointers. I also know C, whence NULL originates, and remember that it's the constant for a null pointer, with type void *
.
For reasons, I've had to use NULL
in my C++ code for something. Well, imagine my surprise when during some template argument deduction the compiler tells me that my NULL is really a ... long. So, I double-checked:
ANSWER
Answered 2021-Sep-04 at 16:50In C, a void*
can be implicitly converted to any T*
. As such, making NULL
a void*
is entirely appropriate.
But that's profoundly dangerous. So C++ did away with such conversions, requiring you to do most pointer casts manually. But that would create source-incompatibility with C; a valid C program that used NULL
the way C wanted would fail to compile in C++. It would also require a bunch of redundancy: T *pt = (T*)(NULL);
, which would be irritating and pointless.
So C++ redefined the NULL
macro to be the integer literal 0. In C, the literal 0 is also implicitly convertible to any pointer type and generates a null pointer value, behavior which C++ kept.
Now of course, using the literal 0 (or more accurately, an integer constant expression whose value is 0) for a null pointer constant was... not the best idea. Particularly in a language that allows overloading. So C++11 punted on using NULL entirely over a keyword that specifically means "null pointer constant" and nothing else.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install macos-buildscripts
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page