|
The very short version...
In the beginning there was machine language very closely tied to the CPU. It worked with numeric opcodes that programmers has to literally memorize or look up. This got old real quick.
ML Pseudocode: Instruction Operation
00000000 Stop Program
00000001 Turn bulb fully on
00000010 Turn bulb fully off
00000100 Dim bulb by 10%
00001000 Brighten bulb by 10%
00010000 If bulb is fully on, skip over next instruction
00100000 If bulb is fully off, skip over next instruction
01000000 Go to start of program (address 0) Enter assembly. It's not a compiler. It's an assembler and also a linker as part of a toolset. There's a difference. A compiler will translate code into something that's a one-to-one correlation with machine instructions. Assembly is already that. It's a language that basically gave human-memorable mnemonics to the opcodes. It was originally written in machine language. It's very CPU specific too. This too got old.
There were a ton of other languages made, presumably written in ASM, but this is where a compiler kicks in. To make a really long story short, I'll just mention C's history. C was based on B and B was based on BCPL. I don't know what BCPL was written in, but the first B compiler was written in BCPL. Eventually, the B compiler was re-written in B itself and then the first C compiler was written in that version of B.
A language written its own compiler happens more than you'd think. Anyway, these are still native compilers and eventually they still make their own down to machine code. Now, things like Java and C# I suspect are still written in native languages for obvious reasons, but don't be surprised if a native language's compiler is written in the same language.
Calin Negru wrote: a standard should be required where the numbers/machine instructions for MOV are recognized everywhere. I mean it should work like a hardware resource with the same ID present on old and new processors. This sounds great in theory, but if you look at how bloated and not-fun the Win32 API is, if you always have to maintain backwards compatibility then you keep things bloated when attempting to advance. I mean, it's good on one level, but it's also good to wipe out the old and try something new, like Apple is doing with the M1 chips (even though nothing is every really new, but you get the idea).
Do we really want processors in 100 years having similar constraints as one designed in the 1960s? Rather than enforce that on the CPU, the industry has (correctly so) to rather have compiler targets implemented. You use your preferred language and it compiles down to whatever the CPU expects with optimizations, etc.
Jeremy Falcon
|
|
|
|
|
Jeremy Falcon wrote: C was based on B and B was based on BCPL. I don't know what BCPL was written in, but the first B compiler was written in BCPL
Whilst I, too, don't know what BCPL was written in, I did hear why it was called BCPL. WikiPedia[^] says it stands for "Basic Combined Programming Language" and was invented in Cambridge University (UK). The story that I heard was there was a more complex language jointly designed by universities in Cambridge and London - that was call CPL (Cambridge Plus London). I do not know if CPL saw the light of day; but a simplified version called Basic CPL (or just BCPL) was created.
It had a bizarre construct, which was definitely a candidate for CPs Wierd and Wonderful forum), to resolve the 'Dangling ELSE problem'. It was something like IF condition DO statement and TEST condition THEN statement OR statement . (See https://www.bell-labs.com/usr/dmr/www/bcpl.pdf[^])
Edit:
I've just read the Wikipedia article (I should have done that before posting!). It says the CPL language was named originally from 'Cambridge Programming Language' and later renamed to 'Combined Programming Language'. No mention of London. But CPL (programming language) - Wikipedia[^] does mention the involvement of London and it was nicknamed 'Cambridge Plus London'. Thus, the name I heard was not its real name.
modified 7-Feb-23 5:26am.
|
|
|
|
|
That's cool to know. Thanks for sharing.
Jeremy Falcon
|
|
|
|
|
|
Message Closed
modified 15-May-23 19:06pm.
|
|
|
|
|
Where did you find this expression?
|
|
|
|
|
Did you read the documentation[^]?
"In testa che avete, Signor di Ceprano?"
-- Rigoletto
|
|
|
|
|
Maybe if you actually provided the full details ...
|
|
|
|
|
[feb 2,2023,3:01am] same as Victor, could you describe the context of that message? A veteran probably needs no further clue to guess the source of where that came from but some of us are not veterans (not me at least)
|
|
|
|
|
Because you're too lazy to do the work yourself, you post this nonsense just so you can down vote answers and legitimate questions? You are a troll.
Quote: From the perspective of an application, a "cancellation point" is any one of a number of POSIX function calls such as open(), and read(), and many others.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
Gerry Schmitz wrote: You are a troll. I tend to agree; he certainly has history. Also complains of being thrown out of other forums for "asking too many questions", but I suspect the real reason is not that.
|
|
|
|
|
|
Hi
just had some discussions. on IBMMAIN regarding the C++ code (DLL) using C++ I developed and tried porting to z/os
since I need a lot of the same functionality
I have been compiling on Z/OS XL C++ and I got some differences
as an example
auto ret = procpointer->extsymcollector->insert({ *s, *exsympointer });
where the XL C++ compiler didnt like the '{'
I was told by someone who works on the XL C++ compiler to ditch MSVC
and go with CLNG/LLMV
by going here
Clang/LLVM support in Visual Studio projects | Microsoft Learn[^]
As MSVC only goes to C++ 11
in addition I was told to ditch XL C++ and go to Open XL C++ As that goes to C++ 17 or 18 and is baseD on CLANG/LLVM
|
|
|
|
|
|
ForNow wrote: As MSVC only goes to C++ 11
No, it fully supports C++20.
Go to project properties pages -> General -> C++ Language Standard and select "ISO C++ 20 Standard".
Now, for that particular piece of code, the "{}" is the C++ initialization syntax available since C++11. You can try replacing that with:
auto ret = procpointer->extsymcollector->insert(T(*s, *exsympointer)); where T is the type of object that is inserted.
Mircea
|
|
|
|
|
David Crayford who works on the XL C\C++ z/os compiler suggested I switch my compiler from MSVC to CLANG\LLVM for a few reason one then seems to be easier portability
Whatโs your opinion
Thanks
|
|
|
|
|
I'm a MSVC and Visual Studio fan. I find it a superb development environment. Compiler is just one piece of the puzzle, but you also need a good editor and a good debugger. All in all, for day to day development, I think Visual Studio is hard to beat. More than once, after developing in Visual Studio I had to port to g++ and I never had any major problems.
Mircea
|
|
|
|
|
|
Mircea Neacsu wrote: No, it fully supports C++20.
Can you independently document that?
Years ago (decades) there was at least one source that did a detailed comparison between compilers to see which ones were most compliant. This was after ANSI C++ was release.
Microsoft did poorly in that comparison.
Then someone sued to prevent such comparisons. Or perhaps added end use license terms that prevented such comparisons. If Microsoft did not start that they certainly participated in it.
So my question then, as it goes back to the first one, is how do you know how compliant they are?
|
|
|
|
|
|
|
Hello friends ! , in my following code in C I want to invert my linked list in the display using a ๐ฟ๐ฒ๐ฐ๐๐ฟ๐๐ถ๐๐ฒ ๐ณu๐ป๐ฐ๐๐ถ๐ผ๐ป ; but the code does not work !! Is there an error; thank you for mentioning it :+1:
#include<stdio.h>
#include<stdlib.h>
struct cellule{
int a;
struct cellule *suivant;
};
//Recursive function to display the list in invers order
void affichage (struct cellule *liste){
while (liste!=NULL){
affichage(liste->suivant);
printf(" %d โ,liste->a);
}
}
int main()
{
struct cellule *liste,*p,*q,*r;
int n,i;
printf(โDonner le nombre dโelements de la liste:\nโ);
scanf(โ%d",&n);
printf(โEntrer les elements de la liste:\nโ);
for(i=0;i<n;i++)
{
p=(struct cellule="" *)malloc(sizeof(struct="" cellule));
scanf(โ%dโ,&(*p).a);
if(i="=0)" liste="p;
else" (*q).suivant="p;
q=p;
}
affichage(liste);
printf(โ\nโ);
system(โpauseโ);
return" 0;
}<="" pre="">
|
|
|
|
|
There are two issues:
1. Where you create the cellule structures:
for(i=0;i<n;i++)
{
p=(struct cellule *)malloc(sizeof(struct cellule));
scanf("%d",&(*p).a);
if(i==0)
liste = p;
else
(*q).suivant=p;
q=p;
}
q->suivant = NULL;
2. Your recursive method
void affichage (struct cellule *liste){
if (liste ==NULL) {
return; }
affichage(liste->suivant); printf(" %d ",liste->a); }
|
|
|
|
|
By "inverted" do you mean you want to print your list in reverse order?
E.g.
input: 1 2 3 4 5
output: 5 4 3 2 1
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Message Closed
modified 15-May-23 19:06pm.
|
|
|
|