Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Search
I have the following code: use serde::{Deserialize, Serialize}; #[derive(Sereialize, Deserialize)] struct Container<const SIZE: usize> { contents: [String; SIZE] } But I'm getti...
I know that 1 is sometimes called a pure function - although apparently a pure function must also not vary when the input is constant. By negation, the other kind are called impure functions, alth...
I know that I can display a single string in the terminal window like print("example") (or similarly with a string in a variable), and I know how to open text files and write to them. I also know ...
A compromise exists between automatically inferring package names (unreliable and potentially dangerous) and writing out an explicit separate requirements.txt file: script-running tools such as pip...
Figured it out. It should be a List. The data type of the list should be object, but the individual objects in the list should be compatible with the data type of the fields of the struct. For ex...
If my struct column has the data type of struct<string, integer> then what should be the equivalent java object that should be inserted into that struct column? I'm trying the following code...
This response is about closure in general, not any specific question. (A moderator has already addressed the specific case.) The close notice also includes the following text (emphasis mine): ...
I am currently working on an Angular SPA that supports multiple languages and relies on ngRx for state management. Although the application state is handled by ngRx, the current language is stored...
Eq is a type class, and type class names are capitalized (like types and constructors). Changing eq to Eq should get you past that error. Conversely, in SimpleEnigma = SimpleEnigma rotor1 rotor...
Highlight.js version: 11.6.0 Node version: v18.12.0 npm version: 8.19.12 When I provide a plugin with the following code to highlightjs (full code is at github): /* Language: BQN Requires: A...
I don't think GNU can be used as a stand-alone tag. Apart from the OS, GNU is also a tool collection of various programs, many used for programming, making is a very ambiguous tag which can't stan...
I'd like to assert that some code can be optimized out, and is not present in the final binary object. #define CONSTANT 0 #if (!CONSTANT) [[landmine_A]] #endif static int foo(void); void...
Apparently this is controlled by the registry value Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\NuGet\Repository\UWPNugetPackages. I changed it from C:\Program Files (x86)\Microsoft SDKs\UWPNu...
The answer is indicated on the page for f. Specifically, "[t]he f object is the singleton false value, the only object that is not true." In contrast, t is defined simply as SINGLETON: t where SING...
I noticed when attempting to generate random booleans that t and f are not treated in the same way: t random ! Error f random ! returns a value In the factor 0.98 and 0.99 documentation, t is ...
Well, you still need (placement) new for the implementation of the smart pointers themselves. You would also use it (or malloc) to implement custom allocators, for example: https://www.boost.org/d...
There are two things going on here. One which technically explains what's going on fully, and another potential misconception you have. For the former, &T implements the Copy trait regardless ...
Starting with the goals: A naming convention typically aims at supporting several, partly contradictory goals, among which are the following: Compliance with the limitations of the language stan...
Yes it is fine and probably encouraged even. I have written several self-answered Q&A here and they were mostly well-received. They aren't all that easy to write though, especially getting the ...
Summary I'm refactoring a Rust-based service/daemon to move away from gRPC and use a Rocket-based API instead. I'm also using the daemonize crate to turn the foreground process into a background p...
Is it undefined behaviour to cast an uninitialized variable to (void)? Example: int main() { int x; (void)x; return 0; }
It is undefined according to my reading of the standard (I am referring to the latest public draft). int x; (void)x; In the second line, (void)x is a full expression, but x by itself is alread...
If you have a class which needs to store a construction parameter internally, and you want to take advantage of move semantics, I understand that the parameter should be passed by value: class Foo...
Update: Distinguished between the general case and cases (as with std::string) where it is known that there are no side effects. In the general case, the substitution of the call to a copy constru...
MWE import pandas as pd import numpy as np import matplotlib.pyplot as plt df = pd.DataFrame(np.random.rand(9, 4), columns=['a', 'b', 'c', 'd']) df.plot.bar() plt.show() Question Ho...