|
Did you read the documentation[^]?
"In testa che avete, Signor di Ceprano?"
-- Rigoletto
|
|
|
|
|
Maybe if you actually provided the full details ...
|
|
|
|
|
[feb 2,2023,3:01am] same as Victor, could you describe the context of that message? A veteran probably needs no further clue to guess the source of where that came from but some of us are not veterans (not me at least)
|
|
|
|
|
Because you're too lazy to do the work yourself, you post this nonsense just so you can down vote answers and legitimate questions? You are a troll.
Quote: From the perspective of an application, a "cancellation point" is any one of a number of POSIX function calls such as open(), and read(), and many others.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
Gerry Schmitz wrote: You are a troll. I tend to agree; he certainly has history. Also complains of being thrown out of other forums for "asking too many questions", but I suspect the real reason is not that.
|
|
|
|
|
|
Hi
just had some discussions. on IBMMAIN regarding the C++ code (DLL) using C++ I developed and tried porting to z/os
since I need a lot of the same functionality
I have been compiling on Z/OS XL C++ and I got some differences
as an example
auto ret = procpointer->extsymcollector->insert({ *s, *exsympointer });
where the XL C++ compiler didnt like the '{'
I was told by someone who works on the XL C++ compiler to ditch MSVC
and go with CLNG/LLMV
by going here
Clang/LLVM support in Visual Studio projects | Microsoft Learn[^]
As MSVC only goes to C++ 11
in addition I was told to ditch XL C++ and go to Open XL C++ As that goes to C++ 17 or 18 and is baseD on CLANG/LLVM
|
|
|
|
|
|
ForNow wrote: As MSVC only goes to C++ 11
No, it fully supports C++20.
Go to project properties pages -> General -> C++ Language Standard and select "ISO C++ 20 Standard".
Now, for that particular piece of code, the "{}" is the C++ initialization syntax available since C++11. You can try replacing that with:
auto ret = procpointer->extsymcollector->insert(T(*s, *exsympointer)); where T is the type of object that is inserted.
Mircea
|
|
|
|
|
David Crayford who works on the XL C\C++ z/os compiler suggested I switch my compiler from MSVC to CLANG\LLVM for a few reason one then seems to be easier portability
Whatโs your opinion
Thanks
|
|
|
|
|
I'm a MSVC and Visual Studio fan. I find it a superb development environment. Compiler is just one piece of the puzzle, but you also need a good editor and a good debugger. All in all, for day to day development, I think Visual Studio is hard to beat. More than once, after developing in Visual Studio I had to port to g++ and I never had any major problems.
Mircea
|
|
|
|
|
|
Mircea Neacsu wrote: No, it fully supports C++20.
Can you independently document that?
Years ago (decades) there was at least one source that did a detailed comparison between compilers to see which ones were most compliant. This was after ANSI C++ was release.
Microsoft did poorly in that comparison.
Then someone sued to prevent such comparisons. Or perhaps added end use license terms that prevented such comparisons. If Microsoft did not start that they certainly participated in it.
So my question then, as it goes back to the first one, is how do you know how compliant they are?
|
|
|
|
|
|
|
Hello friends ! , in my following code in C I want to invert my linked list in the display using a ๐ฟ๐ฒ๐ฐ๐๐ฟ๐๐ถ๐๐ฒ ๐ณu๐ป๐ฐ๐๐ถ๐ผ๐ป ; but the code does not work !! Is there an error; thank you for mentioning it :+1:
#include<stdio.h>
#include<stdlib.h>
struct cellule{
int a;
struct cellule *suivant;
};
//Recursive function to display the list in invers order
void affichage (struct cellule *liste){
while (liste!=NULL){
affichage(liste->suivant);
printf(" %d โ,liste->a);
}
}
int main()
{
struct cellule *liste,*p,*q,*r;
int n,i;
printf(โDonner le nombre dโelements de la liste:\nโ);
scanf(โ%d",&n);
printf(โEntrer les elements de la liste:\nโ);
for(i=0;i<n;i++)
{
p=(struct cellule="" *)malloc(sizeof(struct="" cellule));
scanf(โ%dโ,&(*p).a);
if(i="=0)" liste="p;
else" (*q).suivant="p;
q=p;
}
affichage(liste);
printf(โ\nโ);
system(โpauseโ);
return" 0;
}<="" pre="">
|
|
|
|
|
There are two issues:
1. Where you create the cellule structures:
for(i=0;i<n;i++)
{
p=(struct cellule *)malloc(sizeof(struct cellule));
scanf("%d",&(*p).a);
if(i==0)
liste = p;
else
(*q).suivant=p;
q=p;
}
q->suivant = NULL;
2. Your recursive method
void affichage (struct cellule *liste){
if (liste ==NULL) {
return; }
affichage(liste->suivant); printf(" %d ",liste->a); }
|
|
|
|
|
By "inverted" do you mean you want to print your list in reverse order?
E.g.
input: 1 2 3 4 5
output: 5 4 3 2 1
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Message Closed
modified 15-May-23 19:06pm.
|
|
|
|
|
If you're having problems understanding that, then you really do need to take a step back, find a good resource for learning C++ and work your way through it. This is simple, basic C++ stuff that you should be able to grok, almost without thinking about it. Using more basic types
class C {
public:
int n;
C() { n = 0; } };
C c; C *pc; C *pc2 = new C();
But these days you really should be using smart pointers instead of new/delete. See the documentation for std::shared_ptr and std::unique_ptr here: [Dynamic memory management - cppreference.com](https://en.cppreference.com/w/cpp/memory)
Keep Calm and Carry On
|
|
|
|
|
Message Closed
modified 15-May-23 19:06pm.
|
|
|
|
|
Every C++ class has a constructor that gets called when the object is created. So if we have
class C {
public:
int n;
C() { n = -1; }
}
int main()
{
C c; std::cout << c.n << '\n'; }
In the class C given above, if you do not give a default constructor, then the compiler will provide one, but it will not initialize the value of C.n
class C {
public:
int n;
};
int main()
{
C c; std::cout << c.n << '\n'; }
Presumably class QBluetoothLocalDevice provides a default constructor that fills in reasonable default values for its members. If some of those members use system resources (e.g. open file handles, memory, etc), then there is also a destructor that gets called when the object goes out of scope to release the resources (e.g close open files, release memory, etc).
Keep Calm and Carry On
|
|
|
|
|
Member 14968771 wrote: Do I have to look thru the QBluetoothLocalDevice class documentation to find which method makes the "test" to contain all the hardware info? Yes, as you would need to do with any class that you are using. And here it all is: QBluetoothLocalDevice Class | Qt Bluetooth 6.4.2[^].
|
|
|
|
|
The first one creates an instance on the stack. It will be destroyed when it goes out of scope.
The second one creates an instance in heap memory*. It will not be automatically destroyed and you should call delete to destroy it.
*Unless new has been overridden to do something unusual.
|
|
|
|
|
1. Create an object on the stack
QBluetoothLocalDevice localDevices;
This reserves all the memory space required for a QBluetoothLocalDevice object on the local stack. It then calls the constructor of the class to initialise any parts of that memory as specified in the class (see answers by @k5054). The variable localDevices holds the address of the object (even though it does not appear to be a pointer).
2. Create an object on the dynamic heap, and return a pointer to it.
QBluetoothLocalDevice *localDevices_new = new QBluetoothLocalDevice();
In this case the memory is requested from the heap, the constructor called to initialise it, and its address returned and saved in the pointer localDevices_new .
The end result is much the same in both cases, apart from the location and lifetime of the two objects. In case 1 the object only exists within the function where it is created; it is automatically destroyed when the function ends. In case 2 the object exists until it is destroyed by the delete statement, or the program terminates.
But as suggested elswhere, this is basic C++, which you should have learned and understood long before you charged down this rabbit hole that you currently find yourself in.
|
|
|
|