Skip to main content
Filter by
Sorted by
Tagged with
0 votes
2 answers
104 views

The formula =SPLIT("1\10/10\00002.2";"\") doesn't result equal to =MAP(SPLIT("1\10/10\00002.2";"\"); LAMBDA(v; v)) At the former, implicity conversion is ...
Daniel Bandeira's user avatar
3 votes
1 answer
85 views

The title maybe vague because I don't know how to describe such situation. // go 1.23.0 package main import ( "fmt" ) func compare(num uint16, bit uint8) bool { // ok return ...
NOSAE's user avatar
  • 2,240
Best practices
0 votes
7 replies
103 views

I am experiencing problems with this section of my formula =LET( args; MAP(SPLIT("11/11"&CHAR(10)&CHAR(10)&"1" ; CHAR(10)&CHAR(10)); LAMBDA(v; TO_TEXT(v)))...
Daniel Bandeira's user avatar
0 votes
0 answers
38 views

I'm trying to set up VS Code to learn C++. I downloaded the latest version of the compiler (g++) and tried running the following simple code, which (if I understand this correctly) should print a &...
Pickman02's user avatar
  • 101
3 votes
2 answers
273 views

So, I am learning C language and was trying to make a function that returns the length of a string. In the if statement I mistakenly used "" instead of ''. So, instead of comparing to char '\...
Schrey's user avatar
  • 69
19 votes
2 answers
826 views

Background Our original problem was that including boost::logic::tribool caused an expression of the form referenceToClass != nullptr to compile happily. We ultimately tracked this down to the ...
Mitten.O's user avatar
  • 1,117
6 votes
1 answer
246 views

I'm getting a compiler error about a type conversion that should be legal, to my eyes. Let's say I have a home-grown string class, convertible from and to char*: class custom_string { public: ...
Peter Yurkosky's user avatar
6 votes
3 answers
266 views

Here's an example: class Example { public: Example(int m, int n, double pad) {} Example(double size, double pad) {} }; int main() { Example example { 1.0, 1.0 }; auto ptr = std::...
Wesley Yu's user avatar
3 votes
2 answers
358 views

Consider this implicit operator: public class Person { public Person(string name) => Name = name; public string Name { get; } public static implicit operator string(Person person) => ...
lonix's user avatar
  • 22.4k
3 votes
2 answers
149 views

I have a program which lets C++ support arbitrary precision numbers (very large numbers). Takes datatype as string or string literals. Basically "762...." Compiler: g++ (Debian 10.2.1-6) 10....
Shaz Kamil's user avatar
5 votes
1 answer
86 views

I have a program that maps device registers to unions of bitfields and integers. This is part of a larger code base, so although this is very C-style code, we are compiling it as C++20. Here is a ...
rmc's user avatar
  • 1,240
1 vote
1 answer
125 views

I have this minimal working example: class A { public: A(int i) {} A(bool b) {} }; class B { public: operator int() { return 1; }; operator bool() { return false; }; operator A() { return A(...
phinz's user avatar
  • 1,647
12 votes
2 answers
407 views

This is a follow up of this question: Why can I call a callable that is const-referenced and where the actual callable is a mutable lambda? I can mimic the implicit conversion of a const mutable ...
463035818_is_not_an_ai's user avatar
-5 votes
3 answers
124 views

I'm still new at functions and I tend to print the function which I don't know how to print the declared function. It prints "1" and not "John". #include <iostream> void ...
NAYbabal's user avatar
5 votes
2 answers
236 views

Take the following (common) scenario when dealing with, for example, OpenGL: You have void glUseProgram(GLuint program);, as well as a host of other functions that all take a GLuint; but there is no ...
Gregorio Litenstein's user avatar
0 votes
4 answers
185 views

char array[8][13]; memset (&array, 0, sizeof(array)); /* this is a rough example this is in a struct that is memset */ if (array[0]) { printf("this is valid"); /* again this code is ...
John Reed's user avatar
2 votes
1 answer
119 views

I'm working with a C++ class that includes both a conversion operator and a constructor that takes a std::initializer_list. According to Scott Meyers in "Effective Modern C++," Item 7, ...
sam's user avatar
  • 911
2 votes
1 answer
104 views

I'm trying to figure out how C++ actually breaks down the argument-passing when the formal argument is a reference and the actual argument is of a type that requires type-conversion. Here's an ...
Joe Black's user avatar
  • 667
0 votes
1 answer
69 views

From the Scala 3 docs on implicit conversions: In Scala 3, an implicit conversion from type S to type T is defined by a given instance of type scala.Conversion[S, T]. For compatibility with Scala 2, ...
Roberto Tyley's user avatar
1 vote
0 answers
107 views

This example: struct X {}; struct Y : X {}; using CY = const Y; true ? X() : CY(); // error Which is explained in this answer, could be changed like this: struct X { operator int() { return 0; } }; ...
Sneed Deens's user avatar
0 votes
2 answers
124 views

From this example: static_assert(std::same_as<decltype(true ? std::string{} : "str"), std::string>); // compiles You can see that result of conditional expression is prvalue of std::...
Sneed Deens's user avatar
3 votes
0 answers
72 views

This is a follow-up of this question: conditional operator expression with base and const derived class doesn't compile, why?. The core is cond ? [cv] T1() : [cv] T2() where, for instance T2 ...
Oersted's user avatar
  • 3,834
6 votes
3 answers
260 views

For some reason this doesn't compile: #include <iostream> struct X { }; struct Y : X { }; int main() { using CY = const Y; true ? X() : CY(); // error: different types 'X' and 'const Y'...
Sneed Deens's user avatar
1 vote
0 answers
55 views

I'm trying to convert an std::array of integers to a string for output, so I tried using this string constructor: template< class InputIt > basic_string( InputIt first, InputIt last, const ...
venyanwarrior's user avatar
0 votes
2 answers
114 views

I read the c documentation but I couldn't understand it. Could you please answer my questions(Maybe my English is not good.) I have two codes and two question. Question about first code: Has an ...
İlker Deveci's user avatar
2 votes
0 answers
60 views

I was digging into code of flatbuffers and it does seem to me that there is undefined behavior in the core library. But I just can't believe it is there (and it seems to work in some usecases)... I'd ...
Richard Steidl's user avatar
0 votes
0 answers
46 views

I'm trying to scan my c# project, to find out which lines have implicit type conversions, then export results to something like a xml file. ReSharper is a probable resolution.I installed the ReSharper ...
Icy's user avatar
  • 21
0 votes
1 answer
59 views

It makes sense that the assignment expression has no ambiguity. But I don't understand why the relational expression does have. #include <iostream> class MyClass { public: operator int() { ...
xiaokaoy's user avatar
  • 1,733
0 votes
1 answer
92 views

I have a PySpark DataFrame schema where the quantity field is specified as IntegerType. However, when the JSON data contains a string representation of a number (e.g., "30"), the record is ...
DumbCoder's user avatar
  • 515
0 votes
1 answer
91 views

Here is a minimal not working example of what I am trying to do : Let import io.github.iltotore.iron.* import io.github.iltotore.iron.constraint.string.* case class User(name: String) type Username = ...
Coo L'Hibou's user avatar
2 votes
2 answers
174 views

If I index an array with an unsigned int or a long, is it being implicitly cast into an int, or is the type somehow maintained? If I use large unsigned int as index, is it cast into a negative int? Is ...
StarEgg's user avatar
  • 51
0 votes
1 answer
140 views

I'm trying to understand the following language from cppreference.com (emphasis mine): Each type of standard conversion sequence is assigned one of three ranks: Exact match: no conversion required, ...
user3188445's user avatar
  • 4,990
0 votes
0 answers
84 views

What warning on GCC and/or clang do I need to activate for this to give a warning? #include<numeric> ... std::vector<double> vec = {1.0, 2.0, 3.0}; auto const sum = std::accumulate(vec....
alfC's user avatar
  • 16.8k
2 votes
0 answers
284 views

I would like to be warned about implicit conversions from any floating point type to any integer type, but not about the narrowing conversion from double to float. E.g for this code int main() { ...
sebrockm's user avatar
  • 6,072
1 vote
3 answers
138 views

Snippet #include <iostream> #include <optional> template <typename T> struct W { operator T&() { return *t; } operator bool() const { std::cout << "...
Juergen's user avatar
  • 3,769
3 votes
1 answer
170 views

I am observing a weird behavior, which I cannot explain. The following code (a simplified version of the actual code) compiles correctly in gcc 11.4, and the argument "val" inside the read() ...
A.Manfreda's user avatar
2 votes
1 answer
111 views

Compiling this C program with gcc 11.4.0 and -Werror=traditional-conversion raises an error: short int f(short int x); short int f(short int x) { return x; } int main(void) { short int a = 0;...
jarufi's user avatar
  • 23
13 votes
1 answer
1k views

We are updating our application from .NET Framework 4.8 to .NET 8. During regression testing, we noticed that implicit widening conversions seem to happen in a different order, resulting in some ...
Scott Lang's user avatar
1 vote
1 answer
83 views

Can someone please explain which language rules are in play in the following example: #include <iostream> #include <type_traits> template<typename T> struct Holder{ T val; ...
Ferenc Janky's user avatar
0 votes
1 answer
95 views

I have C legacy code with structs. It looks like this: typedef struct data { int a; } data; typedef struct user { data d; } user; data* get(user* u){return &u->d}; Now I want to ...
ElkeAusBerlin's user avatar
2 votes
3 answers
233 views

I am trying understand the reference initialization in C++, especially for initializing lvalue reference to "const" and rvalue reference. As I read the standard draft in here: https://eel.is/...
CppCoder's user avatar
0 votes
3 answers
131 views

In trying to understand pointers, I created a M[x][y] array, a pointer to said array *p_M[x] and a pointer to said pointer **d_p_M. The first pointer points to the first element of a row in the array ...
pasty guacamole's user avatar
7 votes
2 answers
158 views

#include <cstdio> #include <string> class A { std::string data; public: A() = default; explicit A (const char* data) : data(data) {} operator const char* () const; ...
Martin Horský's user avatar
2 votes
3 answers
164 views

I have the following variable char* a[2][2] = {{"123", "456"}, {"234", "567"}}; I wanted to refer it using another variable. While the cast works, accessing ...
5reep4thy's user avatar
0 votes
2 answers
74 views

#include<stdio.h> int main() { int a[5]={5,10,15,20,25}; int *p; int i; p=a; for (i=0;i<=5;i++) { printf("the address of the %d is = %d\n",*p,p); ...
khushal dak's user avatar
1 vote
1 answer
76 views

I have the following piece of code: template<class A> struct X { template<class T> X(T t) {} }; template<class A> void f(X<A> x, A a) {} int main() { ...
Iris 's user avatar
  • 19
1 vote
1 answer
84 views

Context I have some functions to support using a custom memory allocator in my library: void *(allocate)(struct allocator *allocator, size_t size, size_t alignment); void (deallocate)(struct allocator ...
DutChen18's user avatar
  • 1,173
0 votes
1 answer
55 views

I have an issue with my code where I'm getting a stack overflow exception when doing an implicit conversion from Calendar to PublicationSchedule. I've cut down the code and can reproduce in Scastie (...
David Regan's user avatar
8 votes
1 answer
91 views

Consider: struct A {}; struct B { operator A&() volatile; operator A&() const; operator A&&(); }; B b; const A& a = b; (godbolt link: https://godbolt.org/z/jcYch9jdW)...
cpplearner's user avatar
  • 19.2k
2 votes
1 answer
55 views

Why in the reference type, even if implicit conversion is done, the actual type conversion is not done even if explicit conversion is done? While studying explicit and implicit transformations, I was ...
JejuOrange's user avatar

1
2 3 4 5
50