Anonymous
I mean you didn’t give it value
Ammar
Looks like bubble sort. The swap value inside of if statement should have been swap = true;.
V01D
Please please please read a C book.
V01D
You are asking us to do every assignment you have and are spamming screenshots
Anonymous
Just wait, I think he will be banned soon due to code photos spam
Ammar
Nisal
Nisal
ɴꙩᴍᴀᴅ
We need some pastebin... https://bsd.to/
ɴꙩᴍᴀᴅ
Oh, message deleted so quickly🤔
Wisenky
Oh, message deleted so quickly🤔
yeah I forgot to share pastebin
Wisenky
how can I put .o files into /obj dir which is subfolder of /project I mean /project/bin&inc&src&obj http://bsd.to/EmoM
V01D
how can I put .o files into /obj dir which is subfolder of /project I mean /project/bin&inc&src&obj http://bsd.to/EmoM
Look at this make file https://www.github.com/V01D-NULL/BreezeOS/tree/master/Breeze%20OS%2FMakefile
Nils
Use qloader and switch to 64bit
$ VISHNU KUMAR D S
Iam beginner how I can learn c
$ VISHNU KUMAR D S
V01D
32bit 🧐
Read the readme
V01D
Use qloader and switch to 64bit
https://www.github.com/V01D-NULL/BreezeOS/tree/master/README.md
Anonymous
Taking input "1,2,3" and printing out 1 2 3 How do I do that?
Naol
int num[3]; cin >> num[0]; cin >> num[1]; cin >> num[2]; for(int i = 0; i < 3; i++){ cout << num[i] <<endl; }
Ammar
Taking input "1,2,3" and printing out 1 2 3 How do I do that?
#include <stdio.h> #include <string.h> int main() { char in[] = "1,2,3"; size_t len = strlen(in); for (size_t i = 0; i < len; i++) { printf("%c", in[i] == ',' ? '\n' : in[i]); } }
MᏫᎻᎯᎷᎷᎬᎠ
Why references require complete types, not just declaration like pointers, especially in the function signature?
MᏫᎻᎯᎷᎷᎬᎠ
Since reference are internally implemented as a non-nullable pointer
MᏫᎻᎯᎷᎷᎬᎠ
Hmm
MᏫᎻᎯᎷᎷᎬᎠ
Okay Thanks
Vlad
random header.h: struct foo; void bar(foo& f);
Vlad
Compiles just fine
Anonymous
Kk Sorry
Wojak
Took me 3 Hours to solve just 3 and then this guy 🚬😐
Wojak
https://youtu.be/oY0PBQt36YM
Nils
./payload/syscalls.h:10:5: error: matching constraint references invalid operand number 10 | int ret; __asm__ volatile("syscall" : "=a"(ret) : "a"(56), "D"(flags), "S"(stack), "d"(parent_tid), "10"(child_tid), "8"(tls) : "memory"); return ret; Hi, any idea what went wrong here?
Nils
https://youtu.be/oY0PBQt36YM
OUCH using "\n" instead of endl in C++ 🙈
Mar!o
OUCH using "\n" instead of endl in C++ 🙈
Using \n is faster because it does not flush stdout
Mar!o
So it's a good reason to use it over std::endl in some cases
Nils
Using \n is faster because it does not flush stdout
And why use "\n" not '\n'?
Nils
wouldn't a single character instead of an entire string save space?
Mar!o
I've not seen the video but generally yes. But at least a small string like "\n" will be allocated on the stack.
Nils
What compiler do you use?
the problem seems to be "rn"
Nils
but I can't figure out what'd be the right way
ברני
If I want on c to make the customer to press a 5 digit number and print the equal only, I should modolo by 10 and then devide by 2 on "if" statement?
V01D
Any idea how Japanese characters are printed in the BIOS (16 bit real mode assembly)?
Ammar
does not work
That's completely different code.
Nils
That's completely different code.
solved, I wrote something much better
Nils
How is it?
int munmap(void *addr, size_t length) { // 11 return __syscall(11, addr, length); }
Ammar
int munmap(void *addr, size_t length) { // 11 return __syscall(11, addr, length); }
I see, It only takes 2 arguments. Sure you don't need r8 for this.
Nils
I see, It only takes 2 arguments. Sure you don't need r8 for this.
void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset) { // 9 return (void*)__syscall(9, addr, length, prot, flags, fd, offset); }
Nils
How is the macro?
It's a real function
Nils
It's a real function
long (__syscall)(long, ...);
Ammar
It's a real function
Oh it is a syscall from standard library?
Ammar
I meant header.
Ammar
How do you put the clobbers?
Ammar
long (__syscall)(long, ...);
I wonder how is the definition of this function?
Ammar
Ref: https://git.musl-libc.org/cgit/musl/tree/arch/x86_64/syscall_arch.h
Ammar
^ That's the complete syscall arguments. I don't really know the way it can be implemented dynamically with single function like that.
Ammar
I just realized that 4-th argument for syscall is not rcx.
Nils
I wonder how is the definition of this function?
.global __syscall .type __syscall,@function __syscall: movq %rdi,%rax movq %rsi,%rdi movq %rdx,%rsi movq %rcx,%rdx movq %r8,%r10 movq %r9,%r8 movq 8(%rsp),%r9 syscall ret
Ammar
.global __syscall .type __syscall,@function __syscall: movq %rdi,%rax movq %rsi,%rdi movq %rdx,%rsi movq %rcx,%rdx movq %r8,%r10 movq %r9,%r8 movq 8(%rsp),%r9 syscall ret
May I know why do you consider it much better? I think it is more expensive as it always touches stack and clobbers registers that are not needed in most of the syscall cases. Is there a purpose behind this?
Nils
Try this one: char *newstack = (char *)mmap(NULL, 8392704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0);
But when I use the newly allocated stack, I get: Jump to the invalid address stated on the next line at 0x0: ??? Address 0x0 is not stack'd, malloc'd or (recently) free'd Process terminating with default action of signal 11 (SIGSEGV) Bad permissions for mapped region at address 0x0 at 0x0: ???