CodeBy
Can't I just send pictures of code 😭 it's hard to explain here
Vlad
If you need to send the whole file pastebin exists
Vlad
CodeBy
Okay let me try
Vlad
@neko_code, @K11M1, @roxifas pliz unmute fellow nibbler
Roxifλsz 🇱🇹
Roxifλsz 🇱🇹
Yeah I see it now, but there's no bot msg for some reason
Never Spam Bot
CodeByOm is now approved by the group admin and can send messages without any restrictions
Now it's working fine ☺️
See spam? Quote the spam message in the group and reply with /spam
Roxifλsz 🇱🇹
should be good now
CodeBy
Thanks 😊
klimi
Vlad
Vlad
Or he's one of those 'got the title but aint got no authority'?
Roxifλsz 🇱🇹
klimi
Faathin
artur kasem
i can shared a free cpp udemy course?
Ludovic 'Archivist'
artur kasem
ok sorry
Benry
Wassap
Roxifλsz 🇱🇹
Wassap
good pfp collection
Benry
harmony5 🇺🇳 ⌤
good pfp collection
It's not complete. I suppose telegram doesn't support high enough pfp limit to include all frames.
Roxifλsz 🇱🇹
Shoaib
Amir
hello guys i hope you have a good day until now
i want to read about pointer in C but i dont have a good resource for that
i found this book<Understanding and Using C Pointers by Richard M Reese> but i dont know it is good and usefull of not
if you can help me for this
emmett9000🔺
Chat Boss
Faathin sent a code, it has been re-uploaded as a quote
Hey guys, is this normal or something wrong with my code?
I want to test if I handling -ETIME correctly but even with timeout occured if never returns -ETIME.
#include <stdio.h>
#include <string.h>
#include <liburing.h>
#include <unistd.h>
#include <linux/futex.h>
#define QUEUE_DEPTH 64
#define BUFFER_SIZE (64 * 1024)
#define BLOCK_SZ 4096
#define WAIT_NR 64
int main(int argc, char **argv) {
struct io_uring ring;
struct io_uring_params params;
int ret;
ret = io_uring_queue_init(QUEUE_DEPTH, &ring, IORING_SETUP_SINGLE_ISSUER | IORING_SETUP_DEFER_TASKRUN);
if (ret < 0) {
fprintf(stderr, "io_uring_queue_init_mem: %s\n", strerror(-ret));
return 1;
}
_Atomic uint32_t vec[64] = {0};
for (int i = 0; i < QUEUE_DEPTH; i++) {
struct io_uring_sqe *sqe = io_uring_get_sqe(&ring);
if (!sqe) {
fprintf(stderr, "io_uring_get_sqe failed\n");
io_uring_queue_exit(&ring);
return 1;
}
io_uring_prep_futex_wait(sqe, (uint32_t *)&vec[i], 0, FUTEX_BITSET_MATCH_ANY, FUTEX2_PRIVATE | FUTEX2_SIZE_U32, 0);
}
struct timespec ts = {.tv_sec = 1, .tv_nsec = 0};
struct io_uring_cqe *cqe;
ret = io_uring_submit_and_wait_timeout(&ring, &cqe, WAIT_NR, (struct __kernel_timespec *)&ts, NULL);
if (ret < 0) {
if (ret == -ETIME) {
printf("io_uring_submit_and_wait_timeout timed out\n");
} else {
fprintf(stderr, "io_uring_submit_and_wait_timeout: %s\n", strerror(-ret));
}
} else {
printf("Submitted %d SQEs\n", ret);
}
unsigned cqe_count = 0;
while (1) {
ret = io_uring_peek_cqe(&ring, &cqe);
if (ret == -EAGAIN) {
break;
} else if (ret < 0) {
fprintf(stderr, "io_uring_peek_cqe: %s\n", strerror(-ret));
break;
}
if (cqe->res < 0) {
fprintf(stderr, "CQE %u error: %d\n", cqe_count, cqe->res);
} else {
printf("CQE %u completed, read %d bytes\n", cqe_count, cqe->res);
}
io_uring_cqe_seen(&ring, cqe);
cqe_count++;
}
if (cqe_count == WAIT_NR) {
printf("All %u CQEs completed successfully\n", WAIT_NR);
} else {
printf("Only %u of %u CQEs completed, likely due to timeout\n", cqe_count, WAIT_NR);
}
io_uring_queue_exit(&ring);
return 0;
}
Rose
Reported Rohit kushwaha [641886621] to admins.
Faathin
Hey guys, I implement Win32 events on top futex for practicing system programming. It use new futex2 API and optimized for Linux like futex_waitv for emulating WaitAny and io_uring_prep_futex_wait for reducing system call emulating WaitAll.
Any feedback or suggestions would be greatly appreciated <3.
https://github.com/kawaii-ghost/futex-event
Chat Boss
No Name sent a code, it has been re-uploaded as a quote
arget_point+(size*0.5), (void*)GLUT_BITMAP_9_BY_15, sa);
char buf[2]; buf[0] = (char)letter; buf[1] = '\0';
renderBitmapString(target_point + 0.02, max_coordinate + (size*0.5), (void*)GLUT_BITMAP_9_BY_15, buf);
}
}
for( int a =0; a < NUM_AGENTS_TYPE_1; a++){
if( agent_type_1[a].shape == SQUARE ){
draw_square_agents( min_coordinate, max_coordinate, size,
agent_type_1[a].x_pos, agent_type_1[a].y_pos, agent_type_1[a].colors, agent_type_1[a].id );
}
else{
draw_circle_agents( min_coordinate, max_coordinate, size,
agent_type_1[a].x_pos, agent_type_1[a].y_pos, agent_type_1[a].colors, agent_type_1[a].id );
}
}
for( int a =0; a < NUM_AGENTS_TYPE_2; a++){
if( agent_type_2[a].shape == SQUARE ){
draw_square_agents( min_coordinate, max_coordinate, size,
agent_type_2[a].x_pos, agent_type_2[a].y_pos, agent_type_2[a].colors, agent_type_2[a].id );
}
else{
draw_circle_agents( min_coordinate, max_coordinate, size,
agent_type_2[a].x_pos, agent_type_2[a].y_pos, agent_type_2[a].colors, agent_type_2[a].id );
}
}
glutSwapBuffers();
glFlush();
}
void reshape ( GLsizei width, GLsizei height ){
if( height == 0 ) height = 1;
GLfloat ratio = (GLfloat)(width)/(GLfloat)(height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glViewport(0, 0, width, height);
if( width >= height ){
gluOrtho2D(-1.0*ratio, 1.0*ratio, -1.0, 1.0);
}else{
gluOrtho2D(-1.0, 1.0, -1.0/ratio, 1.0/ratio );
}
}
void process_normal_keys( unsigned char key, int x, int y ){
if( key == 'x') // exit animation
exit(0);
else if( key == 'p') //pause animation
isAnimating = false;
else if (key == 's') //restart animation
isAnimating=true;
}
void animate ( int value ){
glutTimerFunc(TIME_IN_MILLISECOND, animate, 0);
if( isAnimating ){
//Ask to players to enter their move
//int user_input;
//printf("\n Please enter a number in [0-10] : \n");
//scanf("%d", &user_input);
update_agents_positions ( );
}
glutPostRedisplay();
}
void initGL( int argc, char **argv) {
glutInit(&argc, argv); // init GLUT and create window
glutInitWindowPosition(X_WINDOW_POS, Y_WINDOW_POS);//Position the windows on the screen
glutInitWindowSize(X_WINDOW_SIZE, Y_WINDOW_SIZE);//Resize the graphic window
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGB);
glutCreateWindow("SINFB2016 project - 2023/2024");
glClearColor(B_RED, B_GREEN, B_BLUE, 1.0);//set the background color
isAnimating = false;
}
No
ok, if you can't help me it's all right, I'm out
Ludovic 'Archivist'
ok, if you can't help me it's all right, I'm out
You can read the rules first if you want help. I also recommend you read http://catb.org/~esr/faqs/smart-questions.html which will help you in formulating your question for it to be likely to be answered
Vlad
Vlad
Ngmi honestly
Ikram Prince
I want training in programming anyone help me 😔
Vlad
Vlad
Vlad
learncpp.com
Ikram Prince
Okay
Rose
User Lauren has 1/2 warnings; be careful!
Reason:
offtopic,ad
touhou
std::string a = "abc";
std::string b = std::move(a);
Is move possible only because std::string implements a move constructor?
Suppose if I create a custom type and don't implement a move constructor for it.
Then does std::move by default will fall back to deep copying?
Vlad
Vlad
Otherwise if member does not have move it should copy
Vlad
Vlad
For primitives it's the same
touhou
Thanks
Vlad
In C++98 same effect as move was implemented with std::swap
Vlad
You make an empty and swap with the one already containing data
Vlad
Hence "move"
Vlad
C++11 gave more robust and less boilerplate ways of doing it
touhou
I'm wondering why I don't see this often talked about and this is the first time I'm hearing this. From C++11 onwards, other than lvalue and rvalue, there are xvalue, prvalues, glvalues.
Just started reading about this.
Vlad
Vlad
Not a proper definition or whatever
Vlad
So yeah I'm just doing less of "acshually ☝️🤓"
touhou
Vlad
Vlad
Especially for high level ones
Vlad
You shitcode something then "why so slow"
Vlad
And because you're like 50 abstractions removed from the machine you don't even know why and where it's slow
Vlad
And complexity of the hardware, OS, VM, libraries, etc pile up so it's hard to decipher if you don't know where to look
Vlad
As much as premature optimization is evil, coding with complete ignorance of the performance of things you're using might result in the complete rewrite in the end
touhou
My messages are getting deleted automatically, not sure why.
Vlad
Vlad
Antispam has a hardon on those
Ludovic 'Archivist'
touhou
Ludovic 'Archivist'
Dm me your message
Ludovic 'Archivist'