3,451
questions
-5
votes
0
answers
42
views
JavaScript Regular Expression Error: "Declaration or Statement Expected" [closed]
I'm trying to create a JavaScript function to validate timestamps in a specific format. I have the following function:
function isTimestamp(line) {
return /^[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3} -...
1
vote
1
answer
98
views
this declaration has no storage class or type specifier - compiler not detecting consteval
I have a question about why I'm getting the two problems, this declaration has no storage class or type specifier, and expected a ';' ln 3 col 11, of the code: Main.cpp:
#include <iostream>
...
1
vote
2
answers
90
views
Is a declarator considered a 'superset' of an identifier in 'C'?
I was reading the C standard (C17) and I still don't get what is the difference between a declarator and an identifier , my guess is that and identifier is just that, the 'ID', the name/alias for a 'C ...
0
votes
1
answer
29
views
How to write d.ts file to let tsc know, that the window object is extended
we have a javascript project and want to move to typescript.
In the current setup, we have a global object (let's call it myGlobal) with variables and functions that we are accessing either through ...
1
vote
2
answers
133
views
How to declare variable by using for-next loop
The following code is very good.
Sub Macro1()
'Convert plain excel data to Excel Table. (Excel workbook consist of 3 sheets)
For i = 1 To 3
Worksheets(i).Select
Worksheets(i).ListObjects.Add ...
0
votes
0
answers
29
views
how to interpret typescript class member using square brackets [duplicate]
I came across the following code snippet while reading some documentation...can someone explain to me how to interpret the following declaration of y within square brackets, at first I thought this ...
0
votes
0
answers
33
views
I keep getting errors with functions, even though I am following learncpp.com's couse and even copying the code [duplicate]
So far, since I'm still only on Unit 2 in the course (https://www.learncpp.com/) I haven't really learned any types of functions other than int and void. Whenever I use int or void, I always get an ...
-2
votes
2
answers
92
views
How do I store integers into 2 different arrays in C programming
The first array is multiples of 5, second array is multiple of 9. I was able to store the input but the printed array seems wrong as it did not print my supposed numbers. Any kind soul could help and ...
0
votes
1
answer
45
views
Exception thrown: read access violation.Unable to read memory
My English is not very good, I'm sorry.I'm a beginner and want to do a problem with Ternary search tree. The problem occurs during the insertion of the node,VS throws an exception in insert_BiTreeNode:...
1
vote
1
answer
69
views
What is the way to glue Cucumber feature steps to their implementation for navigation in Goland?
I'm using godog as a testing framework and Goland as an IDE (with Cucumber and Gherkin plugins installed).
I have features files and steps implementation and the tests work well (steps are found and ...
3
votes
4
answers
147
views
Structures declared in function prototypes
I have two functions. pos(), which defines a struct as its return type, and bar(), which defines a struct as an argument type:
#include <stdio.h>
#include <stdlib.h>
static struct foo { ...
1
vote
2
answers
75
views
conditional variable types in C# interop depending on OS and Architecture
C# Interop question.
i have a C++ library that uses a struct:
struct CPPSTRUCT
{
long v1;
short v2;
long v3;
}
In C#, I have a corresponding structure:
[StructLayout(LayoutKind.Sequential)...
2
votes
2
answers
79
views
when a variable has no value initialised in local scope it seaches value global scope
#include<stdio.h>
static int i=27;
int main()
{
static int i;
printf("%d",i);
}
The output of this program is 0 as the local scope has auto initialized 0 as i empty but should'nt ...
1
vote
1
answer
81
views
Trying to understand the different ways of initializing std::string
std::string str;
std::string(str);
std::string str = {};
Are they the same? If no then what's the difference? And when should I use each of them?
New to C++ and trying to understand the different ...
0
votes
2
answers
64
views
Why can I redeclare a variable of the same name as a function parameter within an if statement?
Below is a trivialized version of a solution I came across while trying to implement a version of the Jquery CSS function.
function CSS(prop, value) {
...
if (value === undefined) {
...
0
votes
0
answers
59
views
I'm getting a fatal error on my wordpress site
Fatal error, can't figure out how to fix! Any input would be greatly appreciated.
Fatal error: Declaration of Walker_CategoryDropdown_Custom::start_el(&$output, $category, $depth, $args) must be ...
1
vote
1
answer
38
views
Why does declaring a variable without a keyword result in a SyntaxError for var and const, but not for let in JavaScript? [duplicate]
Declaring variable in JS without keyword.
I get SyntaxError when I declare variable like var = 1 or const = 1. But I don't get this error when i declare like let = 1. Why is this happening?
var = ...
0
votes
0
answers
33
views
TypeScript - Invalid module name in augmentation, module '*.mp3' cannot be found
I got this error
Error: Cannot find module '../../../CONFIGS/OpenSupport.mp3'
I just googled it and found this solution. But this solution doesn't work...
I already tried
declare module "*.mp3&...
0
votes
0
answers
32
views
QNX 7.1 Conflicting declarations due to #include_next
I'm struggeling to get a QNX-Target (applies to both x86_64 and aarch64) compiled due to conflicting declarations in combination with #include_next statements. It is related to stdlib.h and cstdlib ...
1
vote
1
answer
33
views
C++ ASAN kicking on decomposition declaration
I did a leetcode question and for following solution ASAN is kicking:
class Solution {
public:
vector<int> rightSideView(TreeNode* root) {
if (root == nullptr) return vector<int&...
0
votes
0
answers
23
views
Typescript Error Uncaught ReferenceError:
** why this Error show in Typescript: **
Uncaught ReferenceError: can't access lexical declaration
'getRequest' before initialization
main.ts:41
main.ts:41
main.ts:41
code :
import { ...
0
votes
0
answers
31
views
Error when linking Libtorch with OpenFOAM: Two or more data types in declaration error, C++14
I am trying to link a custom library of (type of combustion class) OpenFOAM with Libtorch for a custom class. When I include some libtorch headers (for example: <torch/torch.h> ) I receive a ...
0
votes
0
answers
48
views
Excel VBA renaming a sheet in VBA that was manually changed
I am new to VBA and am currently working on making template production sheets in Excel more user friendly for my company. The goal i for the user filling out the sheet to be able to input all data a ...
1
vote
2
answers
146
views
Why must a comma expression used as an array size be enclosed in parentheses if part of an array declarator?
I just noticed that int arr2[(777, 100)] is a legal array declarator, while int arr1[777, 100] is not.
A more verbose example for compiling would be this
#include <stdio.h>
void f(int i) {
...
1
vote
1
answer
94
views
How can * both declare pointers and dereference pointers?
I'm confused as to how the dereference operator functions in pointer declarations.
Consider both these scenarios:
int y = 5;
int *x = &y;
int y = 5;
int *x;
x = &y;
The second scenario (...
2
votes
3
answers
73
views
Can a tentative definition use the storage class specifier _Thread_local?
The C17 draft states the following (6.9.2, ¶2):
A declaration of an identifier for an object that has file scope without an initializer, and without a storage-class specifier or with the storage-...
0
votes
0
answers
91
views
In Haskell, what does `Con Int` mean? [duplicate]
In the 1995 paper by Philip Wadler "Monads for functional programming" he gives an example of an evaluator:
data Term = Con Int | Div Term Term
What does Con Int mean in this context?
It ...
0
votes
0
answers
24
views
How to do declaration in Visual studio 2022 if Top level statement is enabled? [duplicate]
I could only see Console.WriteLine("Hello, World") in Visual studio 2022. When referred this Link, the good old structure can be brought back, but question is, in this new template, how can ...
0
votes
1
answer
57
views
Variable not defined error after defining variable in another function
My IDE is telling me that the variable multiplied isn't defined:
def multiply():
surrounding_x()
multiplied = False
x_index = chars.index("x")
before_x = chars[x_index - ...
0
votes
1
answer
84
views
How to add a property in FastifyRequest's interface without overwriting everything in a declaration file
How do I add a property to a interface using declarations, without overwriting everything in this object.
declare module 'fastify' {
interface FastifyRequest {
user: User;
}
}
//auth.ts
......
4
votes
2
answers
72
views
Why is it possible to change the value of an integer indirectly via a pointer to a constant int?
I read many old questions, many answers about const keyword in a declaration to deeply understand the syntax of declarations.
I played with const and I am now a little bit confused with this example :
...
0
votes
1
answer
609
views
Vuetify preset Essentials cannot find module 'virtual:generated-layouts'
I'm starting a Vuetify project with Vue3 and want to build it.
Npm run dev is working fine but npm run build failed on this error :
Thanks in advance for the help.
I found out with some tests that ...
1
vote
3
answers
113
views
Why can you use a typedef'd struct before the typedef?
Here's a MWE:
#include <stdlib.h>
typedef struct node_type {
struct node* next;
struct node* prev;
} node;
int main(int argc, char* argv[]) {
node* n = (node*)malloc(sizeof(node));
...
0
votes
1
answer
92
views
Is It Not Possible To Declare A Variable of Abstract Type In C++?
I have the following switch statement in C++ where BaseType is an abstract class:
switch (foo)
{
case 1:
{
DerivedType t = SomeDerivedType(); //Instantiate some derived type.
...
-3
votes
1
answer
90
views
How can I fix the variable declaration error?
I am a programming newbie.I am trying to capture a udp ethernet packet,I use the following code:
using PcapDotNet.Packets.IpV4;
using PcapDotNet.Packets.Transport;
using PcapDotNet.Packets;
//.. ...
1
vote
3
answers
195
views
Can I declare an array of different length arrays in C without variable names?
I am trying to figure out if it's possible to do the following, but without having to declare the individual variables...
static char *set_list1[] = { "set", "one", NULL };
static ...
0
votes
1
answer
72
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
148
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
0
answers
36
views
C++ static variable declaration - difference between module vs function
This is probably answered on the web somewhere, but I had trouble querying via search engine.
In order to adhere to the construct-on-first-use idiom, I have moved static object declaration from the ...
0
votes
0
answers
57
views
Dynamically access the declarations array of my Angular module
I recently upgraded a project from Angular 9 to 17. Everything finally went together (although after quite a struggle), but I wanted to go further and reorganize the whole thing, so I created a new ...
0
votes
2
answers
80
views
How do I do a typedef in mojo?
I want to implement a class with a property whose type I can change globally at compile time.
For example,
let ID_TYPE = Int
@value
struct MyStruct:
var a: ID_TYPE
However, let seems not to be ...
0
votes
1
answer
42
views
identical variables declared 'extern' in multiple translation units can be unique entities?
According to the C99 standard:
In the set of translation units and libraries that constitutes an entire program, each
declaration of a particular identifier with external linkage denotes the same ...
-1
votes
1
answer
208
views
Question about Friend functions used in C++ [duplicate]
I am working with a C++ class that includes a friend function for calculations. However, I noticed that even though the friend function is declared within the class, it seems to work without being ...
0
votes
0
answers
47
views
XSL Output declaration
I need to output declaration to XML like
<?xml version="1.0" encoding="UTF-8"?>
I try convert HTML to XML.
My XSLT:
<?xml version="1.0" encoding="UTF-8&...
0
votes
1
answer
78
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
vote
2
answers
93
views
typedef struct <struct_name> vs simply typedef struct [duplicate]
typedef struct Node{
int data;
struct Node *next;
}Node;
typedef struct{
int data;
Node *next;
}Node;
What is the difference between these two, i.e between struct Node <name> ...
1
vote
3
answers
187
views
Is char s[] = {"ABC"}; legal?
#include <stdio.h>
int main(){
char s[] = {"hello"};
printf("%s", s);
return 0;
}
This code can be compiled and executed successfully,but how can one dimension ...
1
vote
2
answers
76
views
c# Implicitly typed arrays behind the scenes
Can someone explain how the compiler proceeds here to find the "common" type (double).
I assume the IConvertible plays a role here?
private static void Main(string[] args)
{
var nrColl = ...
2
votes
1
answer
145
views
Invalid c declaration that passes k&r grammar
On k&r 2nd edition p123, it shows the grammar of declarator
I've found similar syntax on c standard n1256
according to this int foo()()() is also a valid declarator (which is obviously not), ...
0
votes
1
answer
90
views
TypeScript declaration merging of interfaces in different files in an Angular project
Which way can I implement declaration merging when the interfaces are in separated files?
There is an interface in file all-data.interface.ts
export interface IAllData {
data1: string;
data2: string;...