1,669 questions
4
votes
2
answers
161
views
If a declaration with an initializer is always a definition, why isn't the declaration of a static const member variable a definition?
In The C++ Programming Language 4th edition, in §6.3, page 153, I read
Any declaration that specifies a value is a definition
Again, in §15.2, page 421,
a declaration with an initializer is always ...
0
votes
2
answers
120
views
Automatic initalization of local variables
According to the C standard, the local variables declared in the local scope would carry garbage value until they are explicitly initialized. In contrast to that, if the variable is declared in the ...
2
votes
2
answers
211
views
Is `int x;` really just a declaration or an implicit definition too?
In C, suppose an object is declared, for instance int x; as an automatic variable. Without initializing it with any value, is it still considered just a declaration and not definition?
Cause ChatGPT ...
-3
votes
1
answer
143
views
C++: What does the (-1) mean at the end of the parameter list in this function?
I don't understand the definition of a function below: What does the (-1) mean at the end of the parameter list?
template<typename RatioT = std::milli>
bool rclcpp::client::...
0
votes
1
answer
58
views
How does Python create values for variables without assignment?
I am reading Engineering a Compiler (Cooper, Torczon) 3rd Edition, Chapter 5 Syntax-Driven Translation. It contains the paragraph:
PYTHON does not provide type declarations. The first use of a name x ...
0
votes
1
answer
147
views
Powershell Core Get-Member
Humbling seeking help. Beginner Powershell Core 7.4.2 scriptwriter. In reference to Get-Member results. My background is that I really prefer using Powershell Core's built in documentation rather than ...
0
votes
1
answer
72
views
Defining function in Python whose one argument is list
There is a part of mathematics called the theory of multiple zeta values (MZVs) introduced around 1992. In this theory, we study the properties of parametric nested infinite series (see, e.g., here ...
1
vote
1
answer
79
views
Set range to read values from one worksheet and write to another
The script is intended to:
Read values from column LADUNGSNUMMER in the worksheet NVL cell by cell.
Find each value in column Transport of the worksheet DATA.
Read the corresponding values from ...
0
votes
1
answer
164
views
Forward declaration struct member access
I have a forward declaration of a struct in .h file and full declaration of the same struct in .c file. I want to access it's members, but I get
member access into incomplete type struct channel
Here ...
0
votes
1
answer
2k
views
Authentication method detail - Password in the cloud
"Password in the Cloud" - is this definition meant to be a catch-all term for any saved/stored credential (via Chrome, Bitwarden, or any other password manager). Or does it have a more ...
0
votes
1
answer
84
views
How to correctly declare function with templated class as return type in header? [duplicate]
I have a template class declared in a header file.
// Matrix.h
template <class X> class Matrix {};
In another header file I have a function declaration which has an instantiation of that ...
0
votes
1
answer
169
views
How to define a seperate implementation of a template class constructor [duplicate]
I am working with an old code in C++ that uses a custom implementation of a matrix class.
The matrix is class is implemented as a template class. The declaration looks like this
/**********************...
0
votes
2
answers
345
views
How to check strength password with function and loop while checking off 3 criteria boxes in Python?
I have an assignment to create a password check that says if the password is strong (3 criteria checked off) moderate (2 criteria checked off) or weak (1 or less). The criteria are: 1: containing 2 of ...
1
vote
4
answers
137
views
How can i solve a problem by using the outcome of a function as a variable in the following?
I have come up with this code:
lista= [5,3.2, 'Error', 44, 'Error', 35]
listb= [70, 70, 20, 410,'Error', 4.9]
for i in range(6):
a= lista[i]
b= listb[i]
if a == 'Error' or b == 'Error':
...
0
votes
1
answer
208
views
`\d` and `d+` got `relation "pg_catalog.pg_roles" does not exist` error on psql
I created person table as shown below:
CREATE TABLE person (
id INTEGER,
name VARCHAR(20)
);
Then, trying to show the definition of person table with \d and \d+ got the error as shown below:
...
3
votes
2
answers
77
views
PHP empty array definition with starting or ending comma
So I've come accross these on PHP8 code from my office (simplified) :
[, $x] = $y;
I also saw the other way
[$x, ] = $y;
What would these do? If I do that in a sandbox and assign random values to $y ...
0
votes
1
answer
117
views
ruby cucumber how to have different steps call same definition using cucumber expressions
Say I wanted
Given something
When the sky is blue
And grass is green
Then I'm happy
but I wanted
When('the sky is blue') do
puts 'good'
end
and
When('grass is green') do
puts 'good'
end
to be the ...
2
votes
1
answer
554
views
What is a "Scalar" in PowerShell
The term scalar is often used in PowerShell issues and documentation along with e.g. the about_Comparison_Operators document. I think, I do have an abstract understanding of its meaning (in fact I am ...
0
votes
1
answer
28
views
RubyMine Cucumber Step Definitions default format I want Cucumber Expressions NOT regular expressions
I've got RubyMine version 2023.1.5 and Cucumber version 8.0.0
When I create a step in the feature file and use the Create Step Definition hover button to create the Step Definitions the definition is ...
0
votes
1
answer
95
views
How to declare some extern variables in a namespace in a header file [duplicate]
I've tried to split my c++ code in multiple files so that it can be cleaner but when I try to test it with building it, I get LNK2005 error.
GlobalVariables.h
#pragma once
#include"ConsolePanel.h&...
-1
votes
2
answers
52
views
Function Input not working as anticipated
I have a unit converter that isn't cooperating as intended. I get traceback on my print line saying it won't print. Here's the code:
def big_to_small(kilometer,hours,minutes):
totalTimeMinutes = (...
-2
votes
1
answer
170
views
Visual studio 2022 pro for JavaScript files the right click option "go to definition" does not automatically open the file like it used to in vs 2019
In Visual Studio 2022 pro for JavaScript files the right click option "go to definition" does not automatically open the file like it used to in VS 2019.
Any ideas how to get this feature ...
0
votes
1
answer
284
views
What does (%f\n) mean in MATLAB?
There's this example that was shown in our class today:
age = 20
fprintf("age is"%f\n);
What is the purpose of "%f\n"?
I initially thought it was a placeholder for variables.
It ...
0
votes
2
answers
292
views
do { } while(0) alternative in macro definition or any other possible options [duplicate]
I have encountered a way of making a multiline macro function definition in C/C++ compilation, that does not meet any clear code conventions (and possibly creates performance drawbacks?). Is it the ...
0
votes
2
answers
47
views
Using 3 OptionButtons - trouble with actuation and variable definition with proceedures
My objective: Use radio or option buttons to select predefined cells and populate them with a alpha/numeric designator (in this case "N1"), Using If-Then-Else, allow user to select a ...
1
vote
0
answers
143
views
How to define the scope of search of "Go to definition" for C/C++ in VS Code
In VS Code, I have a workspace with two folders (two C/C++ projects): P1 and P2
I have two functions foo() defined in both projects (same prototype):
P1/foo.c
P2/foo.c
When I Ctrl+Click on a call to ...
0
votes
0
answers
76
views
Are metaclasses objects? [duplicate]
I always hear or read that 'everything in Python is an object'. This sentence is really helpful for beginner programmers as myself, and I was quickly able to understand that classes, methods are ...
-1
votes
1
answer
84
views
#if and #elif doesn't work as intended in Cpp
I am trying to make some sort of easy way to define mcu that I use, and by defining mcu, different header files should be included. I tried doing it with #if and #elif directives :
#include "...
-5
votes
1
answer
77
views
What is the formal definition of Θ(f(n)) without expressing Θ(f(n)) in terms of O(f(n)) or Ω(f(n))?
Θ or Θ(f(n)) is often defined in terms of O(f(n)) or Ω(f(n)). Other answers on this site define Θ(f(n)) in this way. What is the definition of Θ(f(n)) without using O or Ω?
Of course, since it is true ...
0
votes
0
answers
60
views
How to to target_compile_definitions() in qmake? [duplicate]
In CMake I use:
#target_compile_definitions(appsap_rtf PRIVATE SAPwithUNICODE UNICODE _UNICODE SAPwithTHREADS)
target_compile_definitions(appsap_rtf PRIVATE SAPwithUNICODE)
target_compile_definitions(...
-5
votes
1
answer
114
views
Is defining a must or not? [closed]
public List<ItemData> itemBase; When i declare this list i can use it without definition is there benefit in defining while declaring variable?
public List<ItemData> itemBase = new List<...
1
vote
1
answer
523
views
How to make definition outside of enclosing namespace
I have a following code:
namespace A
{
template <typename T>
void func(T);
namespace B
{
class foo {};
template <>
void ::A::func(foo); // ERROR
class bar {};
class foobar {}...
3
votes
2
answers
471
views
Are function definitions present in header files?
In C/C++, are function definitions present in header files or only declarations?
Take for example function pow() in math.h. If function's definition is not present in the header file, then what does ...
0
votes
1
answer
355
views
Sampling frequency for any Continous Signal on a Time Interval
While learning about Sampling Frequency I came across two definition
First :
The sampling frequency in a given time interval represents the number of samples taken per unit of time during that ...
0
votes
1
answer
145
views
What's the difference between these two definitions of a virtual function? [duplicate]
I was getting an error in something called TouchGFX and it was pointed out to me that a virtual function inside a class needed to be defined with curly braces vs just a semicolon at the end of its ...
1
vote
2
answers
519
views
Unable to resolve multiple definition error while linking files [duplicate]
I am working on a question from my computer programming course this semester and am unable to resolve a linker error that I am facing. Can someone take a look at the following files and let me know ...
2
votes
1
answer
123
views
How can I define a space-efficient 8-byte structure in C++ for storing two types of information?
I am trying to define a structure that is 8 bytes large. The structure has to be space efficient since we will have millions of these and the amount of memory we use for it is at a premium.
The ...
0
votes
1
answer
113
views
Why is the definition of convergence different for root finding algorithms as compared to sequences?
The definition of convergence for root finding algorithms is given in a few sources as:
A sequence ${x^k}$ generated by a numerical method is said to converge to the root $\alpha$ with order $p\geq 1$ ...
0
votes
1
answer
330
views
How to copy block definition in autocad?
I need to copy block definition (not block reference) and set to copy other name in autocad 2022 within one drawing. How can I do that?
-2
votes
1
answer
89
views
about ## to connect macro and invoke different functions
// file a.h
// #define MY_MACRO( size, name )
MY_MACRO( 1, var_a )
MY_MACRO( 2, var_b )
MY_MACRO( 3, var_b )
MY_MACRO( 4, var_b )
MY_MACRO( 5, var_b )
MY_MACRO( 1024, var_c )
// file ...
0
votes
2
answers
67
views
How to use the macro definition to modify the name of the function by passing parameters
My question is:
when i=1
P_COMInit(i) = do { P_SEGi_OUTMODE();}while(0)
but not
do{P_SEG1_OUTMODE();}while(0)
How can I achieve what I want?
I want to replace the code above with the macro ...
0
votes
1
answer
261
views
Define words in a text by hovering over them
I am trying to create a program for teaching English.
My aim is to take a text and have it so that students can read the text, and get the definition of individual words by hovering over any words ...
3
votes
3
answers
294
views
Are all curried functions considered higher-order functions?
If you take the definition from wikipedia of a higher-order function, it is a function which either takes another function as an argument and/or returns another function.
From my (limited) ...
1
vote
1
answer
656
views
How is it in Spark, reduce and aggregate are the same
• In math, we think of reduce when a denominator and numerator share the same multiplier and that multiplier is “reduced” to a simpler concept (as in “is divisible by”).
• In math, an aggregate, ...
0
votes
1
answer
155
views
How to update a variable after it's returned in a function without repetition
i am making a game(cookieclicker to be exact)
im running of a problem of repetition so I fixed it but theirs still a problem of var not being returned, i cant seem to find a way to do it without ...
0
votes
3
answers
283
views
Impenetrable confusing definition of API
So I was going through the Wikipedia page on API, in the first paragraph it is stated that
A document or standard that describes how to build or use such a connection or interface is called an API ...
0
votes
1
answer
457
views
Function definition not found (even if they exist)
Here's my main:
#include "terremoto.h"
int main(){
std::string filename, zona;
std::ifstream in_stream;
std::ofstream out_stream;
nodo *elenco, *filtroZona;
std::list<...
-1
votes
2
answers
57
views
Multiple Definition Error Using Header and Implementation Files in C
With the header file (UDPRBPlib.h) and the implementation file (UDPRBPlib.c) I keep getting errors of multiple definitions for global variables and all of my functions shown below:
/usr/bin/ld: /tmp/...
0
votes
2
answers
96
views
A question about type conversion in C language
How to understand the conversion of character '!' to int type in C language is the process of converting from 1-byte 33 to 4-byte 33
I know that 33 is an Ascill table value, but why do they use ...
-1
votes
1
answer
817
views
In Lean, how can i get the element from an exists_unique in a definition
I want to make the following
variables {Ω : Type} (P:set Ω → Ω → Prop)(a:Ω)
def G :set Ω → Ω:=
begin
intro V,
by_cases h: ∃!u : Ω, P V u,
--I want to use the u that is unique as return in this ...