mito
Don't worry buddy, we actually know how to use a search engine.
● Igor
what are the overheads of using C++ classes instead of C structs? for example: classes has constructors and destructors
● Igor
not considering virtual methods
Pavel
not considering virtual methods
If nothing virtual then no overhead, you define constructors and destructors yourself so you decide if they will do extra work or not
Pavel
Library types can impose some hidden overhead because they do something on construction/destruction/copy, but most of them don't do more than necessary to have valid code (maybe except for exception safety, if you don't care about it, but I think you can opt-out from that)
Hussein
If this stuff is simple, what now complex?
an almost 400 page long book called “database internals” that teaches you how make database management systems that are performant and really efficient like MySQL , PostgreSQL or Cassandra in addition to few research articles published by IBM and Intel about this topic
Hussein
If this stuff is simple, what now complex?
but you shouldn’t start something complicated like that a simple database isn’t a big deal
Hussein
.
for example a simple database for numbers let’s say each number would be 4 bytes simply write them to the disk then you got your self a database similar to Excel then maybe with GTK or QT create a program that create spreadsheets
pavel
so no default constructors / the default has no overhead?
in general you can write the same code on c++ as on c
Pavel
so no default constructors / the default has no overhead?
Yes, but again, if you have class CustomClass1 { CustomClass2 a; ... }; And if CustomClass2 has non-trivial constructors/destructors/... then CustomClass1 will also have non-trivial constructors/destructors/...
Pavel
You can actually check for that at compile time, there are some type_traits to ensure the class is trivially constructible/copyable/...
Pavel
I can find an example if you want
Hussein
Okay
even web servers just google “http get requests“ or “http post requests” or “http protocol” the first result is probably from mozilla’s officail website that will tell you how HTTP works in addition to few articles on midium that will explain how to make a simple web server or other any tutorial
Hussein
pretty cool
it has been a tough one but totally worth it
Hussein
Good day! Sorry to ask. I'm just trying to learn a new topic. Namely, drawing graphs in C. And I can not understand that this requires a special program or C has a library for such purposes? I will be grateful for the answer
libgd is a good and performant library which you can use for big datasets there is gnuplot which is more flexible but doesn’t have the performance of libgd also I heard MathGL is a good one but I haven’t tried it myself
buğra
can anyone suggest a decent pointers tutorial where i can totaly understand the topic? it still could not sink in my mind tho i watched many videos
der ðiβüśüɾę
Hello guys, i found the code and i think it violates standards of c programming language. It pretty short. #include<stdio.h> main() { int *p, **q; printf("%u\n", sizeof(p)); printf("%u\n", sizeof(q)); } What do you think?
der ðiβüśüɾę
About what? It'll print the same values
Yeah, it works, but there's no space between include and stdio.h, main without data type. It is normally? I am just beginner in C.
pavel
You should always return int value from main
der ðiβüśüɾę
Include is normal. Main probably return int by default. But it's bad style
Oh thanks 😊 I knew this and you confirmed my thoughts
IPTV E P2P
hello could anudsr me in a c code
🔥आदित्य 🚩
Hii
🔥आदित्य 🚩
Anyone wants to participate in a coding contest
🔥आदित्य 🚩
Aicte certified coding contest
Hussein
I don't understand and also why does it takes first student inputs correctly ?
C++ IO might have a different buffer for cin from C which uses stdin ( AKA each language implemented its own IO buffer caching so maybe because stdin never gets flushed while cin always flush its own input buffer correctly ) so you should either code in C or C++ ( or disagree with everyone here and try fflush( stdin ) after gets() like C programming legend who hates C++ style but has to use it 😎😇🤐 ) btw in C you should use fgets() for simple unformated console input and forget about gets() because it’s buggy and unsafe plus no compiler expect you to use it in the next million years
Hussein
A question that always occurs to me: what happens when two or more transactions are received at the same time, like which one will be chosen?
if any transaction was issued it will be stored in a Write-Ahead storage (a separate file act as a stack) and changes will remain in memory until a certain number of transactions or some sort of checkpoint was reached then the changes will be commited in the main datafile pages (it is where data is stored and divided into 4KB or so “pages” to speed up disk IO) each transaction on the write-ahead storage has serial number so transactions are executed in order and you can do some optimisation where if two transaction modifying the same row/column (depending on the type of the database) the most recent that has a larger serial number will be commited to disk instead of modifying the disk twice
You know me
I was asked in an interview, say i need to create a new object of the concrete type to which the base pointer points to. How to do that ? I gave 2 obvious options of dynamic_cast and typeid but he said both will need if-else. Any one know of any other method ?
Hussein
can anyone suggest a decent pointers tutorial where i can totaly understand the topic? it still could not sink in my mind tho i watched many videos
Jacob Sorber has an Ok and pretty simple tutorials about C on youtube (not promoting him) also there is one youtube channel called cherno about C++ But I have finished it the full series yet so I’m not sure about pointers but tbh (without the admin’s opinion influencing mine) the Resources in this group are pretty great so make sure to check them out especially book recommendations for C and C++ but you know books take time until you make peace with them especially when some of them tend to be written in a language that feels like reading a court case written by a lawyer in the 1950s but you will get used to them sooner or later
You know me
Need if-else for what?
If-else to identify exactly which derived type is. Base->Derived1 or Base-> Derived2
You know me
So Base *b=new Derived2;
You know me
How to determine concrete type form b ?
Hussein
Nice How those changes are represented in the memory? Is it something like this? - Chane row number 1 to X - delete row number Y
usually it is implemented in an enum like this enum commands{ modify = 1, del_row = 2, add_row = 3, search = 4, ..,..,.. ..,..,.. }; and stored in a binary format take this as an example [LSN] [add_row] [database name length] [database name] [table name length] [table length] [value length] [value] [row index] note that row index might look different depending on the database type paradigm whether you will search for the key or you know the position of the row so you can access it directly later
Hussein
Nice How those changes are represented in the memory? Is it something like this? - Chane row number 1 to X - delete row number Y
the write-ahead log is stored on disk not memory it’s like a separate database (stack data structure) which is basically a todo list of transactions but until it is commited to the main database the changes will take place temporarily on memory (a separate cache on memory) then they are commited on the main database
Hussein
Okay Thanks Hussein
you’re welcome there is a book called “database internals” that explains the details of this topic you can read it (legally or pirated😈) which I think might help you understand this even better
Anonymous
I'm having hard times understanding advanced recursive problems like permutations of a string, what should I do to get better in recursion?
Er Manu
I am looking for someone with whom I can study programming together and with whom I can discuss programming topics . I have to make a premise : i am at the basics, that Is to the two dimensional arrays. Studying with someone Is Better than Studying alone.
conko
I'm having hard times understanding advanced recursive problems like permutations of a string, what should I do to get better in recursion?
You can read books about functional programming, they will help you to better understand some functional design patterns including recursion.
Hussein
I'm having hard times understanding advanced recursive problems like permutations of a string, what should I do to get better in recursion?
try to make a recursive function yourself in Python or lua or javascript then do it in C or C+¥
conko
It's a part of the standard.
pavel
Why making main return 0 by default a bad style?
You should return code explicitly
conko
When we talk about "main should return int", we are talking about its return type. Some compilers support void main, which violates C++ standard (not C standard though, ISO C support impl-def main with customized return value.)
Hussein
Why making main return 0 by default a bad style?
yeah but it’s deprecated because it makes things confusing when you call exit() and few other problems
Anonymous
Hey
pavel
When you run some process you should know is it finished successfully or not
Hussein
Why making main return 0 by default a bad style?
the program has to return 0 to tell the os that the program exited successfully even though I do sometimes forget out of laziness you should
Anonymous
I just wanted to know that can we use switch statement for multiple cases or just a few
conko
When main reaches the end of flow of control without a return statement, it'll return 0. It's a common knowledge so I personally disagree it'll lead to any problem without explicit return.
conko
Of course returning 0 instruct a successful state, but it cannot be a reason to require explicit returns in main, for the default behavior is "program ends successfully" exactly.
conko
In a few word I just personally deem it cant be a problem
pavel
When main reaches the end of flow of control without a return statement, it'll return 0. It's a common knowledge so I personally disagree it'll lead to any problem without explicit return.
Unfortunately main function is exception from others functions and don't follow common standard. I always force compiler to interpret warning (non void function doesn't return value) as error. Developer always should take care what does function return.
Anonymous
Given two non-negative integers A and B, and limits X and Y,find the smallest integer Z which lies between X and Y such that (A&Z).(B&Z) is maximum possible. &=Bitwise product Can anyone help me in this
conko
However, main return 0 by default is common knowledge
Anonymous
You can read books about functional programming, they will help you to better understand some functional design patterns including recursion.
This is the first time I have heard of "functional programming". I have been working on C programming for one year, is it related to C language?
Grigoriy
How can I declare an "extern" full specialization of function template in header file?
\Device\NUL
No, Unix error code is returning 0 if success
\Device\NUL
You can value check that program returned with echo $?