The more appropriate solutions however is to write a polymorphic functor, I have namespace operators for that. So that would be operators::push_back {}, or val<operators::push_back>() if I needed to imbue that into the EDSL specifically.
Hell yeah. The sun's shining brightly through my open windows and I'm just sitting here sipping banana juice and eating strawberrys. I love days like this.
The outcome of the following macro is clear:
#define CRASH() do {
*(int *)(uintptr_t)0xbbadbeef = 0;\
((void(*)())0)();
} while (false)
My question is, what does the line
((void(*)())0)();
break down to, in English? For example, "this is a function that returns a pointer to a...."
I'm trying to make a Python program that interfaces with a different crashy process (that's out of my hands). Unfortunately the program I'm interfacing with doesn't even crash reliably! So I want to make a quick C++ program that crashes on purpose but I don't actually know the best and shortest w...
Its just cause i can't think of way to search through a string, and see if another string is in that string .... I was looking at the kmp algorithm, but i dont think that will run in O(n*m) time :(
@RMartinhoFernandes yeaa i have something like that but for strings with multiple similiar characeters like "abcaabe" if i wanted to look for "aa" I would loop to check if haystack[0] == needle [0] and since they do and check if [1] == [1] .. but since it doesnt i get stuck :S
The worst thing is : even if I could convince them to restore the usual behavior or use explicit std::nothrow, obviously nobody wants to change all his code back.
@RMartinhoFernandes I think MFC is still based on no-throwing new. But one has to keep in mind that MFC had exception support in the early 90's. And RTTI. All macro based, all before C++ got language support for it. So it's backward compatibility with a once technically advanced solution (the original name was AFX, not MFC).
Oh joy! The MVC awards are not yet decided, so I still have a chance! For free tools... :-)
Except maybe I then have to refrain from offending people. :-(
@Beginnernato though I wasn't sure what you want the function to return, positions of matched string, or count of matches or even just boolean match or no match
@thecoshman Well mainly i want it to return the string with teh first occurance of the needle, but i want to make a boolean to check if the needle is in the haystack in the first place
Finite difference time domain is an algorithm for simulating electromagnetic waves. I write a serial code and for decreasing the runtime I want to write it in parallel form.I did it but my code has two problem: 1)because each processes has the whole simulation stuffs the amount of memory that my ...
Interestingly, the one asking the question doesn’t seem to be an idiot – at least the maths here is quite advanced. But the code is completely unusable.
@RMartinhoFernandes how would i check if a string starts with another ? I'm not familiar with checking of the whole string starts antoher string ... I've just been comparing characters so far :S
@NahumLitvin also, pretty much every language works natively with command lines, but most have bits for GUI stuff. I don't think C is that related. Laziness is.
@Beginnernato check each character one by one. if they don't match, stop. If either is zero, stop.
@Beginnernato You compare character 0 from one with character 0 of the other, character 1 of one with character 1 of the other, ... and so on, until one of them ends, or they're different, whichever happens first..
@thecoshman they're working on a variant of strcmp at the moment, as a sub-component of strstr. Your comments in that context might be misleading to the poor guy.
Actually, now that you mention it, since this template function must also be in all TUs, that makes this a very silly solution. – Mooing Duck 20 mins ago
@Beginnernato they let you edit multiple files at once with syntax highlighting and other goodies made especially for coding. You press a button and it compiles and runs, or clearly shows errors. You can also set a line of code as a "breakpoint" which causes it to stop at that line and show you every detail of what your code is doing and how it works. It's essential for programming.
I have a 2D lookup table of int16_t.
int16_t my_array[37][73] = {{**DATA HERE**}}
I have a mixture of values that range from just above the range of int8_t to just below the range of int8_t and some of the values repeat themselves. I am trying to reduce the size of this lookup table.
What I h...
The second paragraph of section 4 of the Stack Exchange Terms of Service, "Restrictions," reads:
Under no circumstances will Subscriber use the Network or the Service to ... (d) post any false, inaccurate or incomplete material or delete or revise any material that was not posted by You.
Th...
@Everyone. Is any research/review/survey paper which talks about the difference between Fortran and C/C++ for matrix/array based programming? I have read a lot of information on SO and SciComp but everything is anecdotal. Has anyone published anything as yet? (P.S. I didn't post this as a question since I believed it would be flagged off as duplicate)
OK! It's normal questions, not trolling. I just want to do the same in pure C, in what way should I do this in pure C to emulate template in this language?
@user1131997 for "templates", you have to write the function different for each type you want to use. Also, because C doesn't have overloading, each has to have a different name.
Improved scalability and reduced memory usage. Link time optimization of Firefox now requires 3GB of RAM on a 64-bit system, while over 8GB was needed previously. Linking time has been improved, too. The serial stage of linking Firefox has been sped up by about a factor of 10.
Oh look, either false positives (how would that be possible?), or errors that point out at the site of use rather than the instantiation that triggered the error in the first place. Not sure if I can -isystem my way out of thise.
Oh god the horror default arguments trigger the warning.
G++ now properly re-uses stack space allocated for temporary objects when their lifetime ends, which can significantly lower stack consumption for some C++ functions. As a result of this, some code with undefined behavior will now break: