« first day (1494 days earlier)      last day (1350 days later) » 

user13168561
1:44 AM
Heyyy
 
user13168561
I just got a lil problem...
 
user13168561
Here's the question... Input Format:

You are given two strings, a and b, separated by a new line. Each string will consist of lower case Latin characters ('a'-'z').

Output Format

In the first line print two space-separated integers, representing the length of a and b respectively.
In the second line print the string produced by concatenating a and b (a+b).
In the third line print two strings separated by a space, a' and b'. a' and b' are the same as a and b, respectively, except that their first characters are swapped.
 
user13168561
Here's my answer:
 
user13168561
It does all things right except swapping the number (Duh)...
 
user13168561
Where am I wrong??
 
2:02 AM
@PeterT thanks for the answer on the feasibility of migrating C++ code. Turns out someone already took on the task (if I understood this correctly) github.com/aimnas/ja2-1.13-source-mirror/commit/…
 
 
4 hours later…
5:46 AM
@Roxanne why swap(one[0], one[4]); instead of just swap(one[0], two[0]); ?
 
user13168561
6:11 AM
OH shoot!!
 
user13168561
That's an another silly mistake :// BTW Thanks, man!
 
user13168561
11:24 AM
Heyyy! well it's solved now
 
user13168561
But I've a question...
 
user13168561
when I put swap(one[0], two[4]); in the code (just a random case, I was messing with the code) and gave the input
abcd
ef
 
user13168561
It gave me this error:
"This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information."
 
two[4] is outside the bounds of the string
 
user13168561
May I know the reason why?
 
user13168561
11:27 AM
Yeah i know!
 
user13168561
But why a runtime?
 
user13168561
That's my question...
 
which platform? might just be the C-runtime, so something called std::terminate or abort() or something like it
 
user13168561
I expect a runtime from Python... C++ uses a compiler, right?
 
so? still has a runtime, smaller than python, but still
 
user13168561
11:29 AM
I use a MinGW On windows 7
 
yeah if it's libgcc_seh then the access violation might get converted to an exception and then call terminate
 
user13168561
Oh, so a compiling language can give a runtime too?
 
user13168561
Sorry, but I was having some misconceptions about c++
 
it's not like a Java or Python runtime where all the instructions run through it, but it's more like a language support runtime
 
user13168561
oh I see...
 
11:33 AM
so it's more like the compiler inserts function calls to the runtime at compile-time rather than the runtime controlling the application
and in the Windows case the runtime registers the seh handler to implement C++ exceptions with the help of the OS
 
user13168561
What is seh handler?
 
https://docs.microsoft.com/en-us/windows/win32/debug/structured-exception-handling
Just microsofts implementation of exception handling
 
user13168561
Okay so it's an exceptional handler in c++ just like try except in python?
 
user13168561
But in the windows way?
 
it's the operating system component for it, this includes hardware interrupts apparently. The C++ exception handling can be implemeted with it, but doesn't have to. If you link against libgcc_sjlj another way is used for exception handling
 
user13168561
11:40 AM
The C++ exception handling can be implemented with it, but doesn't have to? Sorry, I don't get it ://
 
C++ is just a specification and describes the features and libraries that a conforming implementation needs. You can implement those features in different ways
 
user13168561
Oh okayyyy
 
12:02 PM
@PeterT fault handling. I wouldn't call it exception handling
@PeterT It's only implemented using it on x86, x64 uses tables and a completely different method
 
 
2 hours later…
2:20 PM
I have trouble understanding following thing from https://en.cppreference.com/w/cpp/language/value_initialization.
It says: "As described in functional cast, the syntax T() (1) is prohibited for arrays, while T{} (5) is allowed."
But in the example below we've got:
int* a = new int[10]();
What am I missing here ?
 
2:38 PM
@domocar1 that's not a cast, it's an allocation of 10 ints?
if you are using new you're allocating memory
 
Can you tell me what is "As described in functional cast, the syntax T() (1) is prohibited for arrays, while T{} (5) is allowed." for ?
 
it's talking about int[10](); without the new
 
the note refers to
using arr_t = int[2][3];
f(arr_t{});
 
that's why it's explicitly saying (1)
 
Oh I see
Okay thanks
 

« first day (1494 days earlier)      last day (1350 days later) »