浩
compile with debug mode, the program crash.
Mohamed Ahmed
What is the size of integer 2 or 4
浩
it seems because debug mode in msvc will change the memory layout.
浩
There is a table
浩
TYPE LP32 ILP32 LP64 ILP64 LLP64
CHAR 8 8 8 8 8
SHORT 16 16 16 16 16
INT 16 32 32 64 32
LONG 32 32 64 64 32
LONG LONG 64 64 64 64 64
POINTER 32 32 64 64 64
浩
windows is often using data model llp64, and linux often using lp64
Leovan
C++ standard says only about char is equal minimum address cell, and short <= int <= long <= long long
\Device\NUL
Just use intX_t macro from stdint and you're good. Since data type is not portable
labyrinth
I would like to know about what are some of the industrial practice for heap memory management with c++
labyrinth
i saw some post decline the use of smart pointers at all, they would rather implement their own reference counting
浩
Anonymous
hello, Anyone who is good in C language?
kamilya
hello, can you please help me find a free program to learn C code?
kamilya
phone app
Nana
Hello
mito
Nana
Pls how can I use my object file in another c++ program?
Nana
Pavel
Pavel
For example, object, do you mean runtime object? Or a class?
Pavel
Or by object file, you mean *.o or *.obj file?
\Device\NUL
Nana
Nana
check the class code
浩
a template class? or just a class?
Nana
Nana
#ifndef RECTANGLE_H
#define RECTANGLE_H
class Rectangle
{
public:
Rectangle()
{
length = 0.0, width = 0.0; // default Rectangle class
}
Rectangle(double, double);
double getLength()
{
return length;
}
double getWidth()
{
return width;
}
double getArea()
{
return length * width;
}
protected:
private:
double length,
width;
};
#endif // RECTANGLE_H
Nana
and finally Rectangle.cpp
Nana
#include "Rectangle.h"
Rectangle::Rectangle(double len, double w)
{
length = len;
width = w;
}
Nana
Nana
Pls I'm waiting for your answers
Pavel
Pavel
Or shared as part of a library also I guess (?)
Nana
Pavel
There are other possibilities, but they are more complex
Nana
That is in case I want to give my class program to another programmer
Pavel
Nana
Pavel
Nana
Grigoriy
How can I define my own clock type if epoch of system_clock is unspecified (untill c++20)? I can't write the function my_clock::now() because of that.
Nana
Jojo
Jojo
labyrinth
vector<int> ({})[26]; this piece of code can compile but I dont understand it
Jojo
Is it possible to add code to smartphone apps or twerk them like adding new functionality
labyrinth
got it, so {} can be replaced with any other legal constructor arguments, but how to make it named?
labyrinth
vector<int> (26,0) [26]; means making an array of vectors, each of which has 26 zeros, but I cant make it named
Misagh
vector<int> (26,0) [26]; means making an array of vectors, each of which has 26 zeros, but I cant make it named
That's a good question.
It seems that I was wrong actually.
std::vector<int>(CTOR)[26] doesn't make an array, but calls vector's operator[] on the temporary.
std::cout << std::vector<int>(10, 33)[2]; //prints 33
And I don't think it's possible to make an array out of a constructed vector.
compiling std::array<std::vector<int>(26, 0), 26> name; gives an error that temporary of non-literal type 'std::vector<int>' cannot be used in a constant expression.
Stas
Hi. I would like to know if someone of you has been used conan with openblas and armadillo on linux machine ?
Amonov
Hello everyone
Jojo
Yo
ㅤㅤㅤ
Is auto in for loop advance version of i version. Or is it from STL in C++
\Device\NUL
\Device\NUL
It just the compiler will automatically define its type like type inference in Go
ㅤㅤㅤ
\Device\NUL
The first loop, after the loop end, i is no longer can be accessed since its scope only in loop
Abid
Pleaze help me to get free liscece key for intelij ide
Anonymous
shriman_deepak
Hello Guys
I want to take arguments from the command line and check whether it is integer or not.
How can i do this ?
shriman_deepak
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
int main(int argc, char* argv[])
{
if ( argc == 3)
{
if ((isdigit(argv[1])) && (isdigit(argv[2])) )
{
// printf("%d ",argv[1]*argv[2]);
}
else
{
printf("Please enter integer values only \n");
}
}
else
{
printf(" Invalid Number of arguments \n ");
}
return 0;
}
shriman_deepak
I have done this but it's not working
Anshul
https://pastebin.com/kt01Y3DS
Anshul
in this code i don't understand why i need to make compare function as static? ( i tried to submit it without making compare function as static but it gives error
Anshul
btw the entire code is written inside a class Solution{}
Anonymous
Hello everyone
Anonymous
I am beginner how i can improve my c++ programming language
Anonymous
I need help