Pavel
Do we always have get the source of compilers, gcc or clang? Is there anything which strips down only to the language implementation?
Compilers and their libraries are the implementations, the specifications are the language standards (a specific C standard or C++ standard)
asterix
Compilers and their libraries are the implementations, the specifications are the language standards (a specific C standard or C++ standard)
You mean as defined by ansi c for c11 or c17. So if i pick any compiler, they will have same implementations for internals of c?
Pavel
You mean as defined by ansi c for c11 or c17. So if i pick any compiler, they will have same implementations for internals of c?
They will have implementations to satisfy the language standard. The standard gives them a lot of freedom to decide details by themselves, that's why they can afford to be so fast actually, and that's why they can compete with each other. They will be different in the implementation
asterix
This seems interesting so I can have my own variant of c if I follow the standards
Cris
You mean as defined by ansi c for c11 or c17. So if i pick any compiler, they will have same implementations for internals of c?
e.g. as long as you align with the requirements of fopen, the standard "guarantees it will work" https://pubs.opengroup.org/onlinepubs/9699919799/functions/fopen.html
Pavel
This seems interesting so I can have my own variant of c if I follow the standards
Yes, you can make your own C compiler and your own standard library implementation
asterix
e.g. as long as you align with the requirements of fopen, the standard "guarantees it will work" https://pubs.opengroup.org/onlinepubs/9699919799/functions/fopen.html
I see so the man pages in linux are somewhat made similar to this standards. Thanks, I see there are many references given to various functions
asterix
Yes, you can make your own C compiler and your own standard library implementation
Just a doubt bothers me, if I make my own compiler then who will compile by compiler
asterix
I wrote a minimal implementation of clib / stdlib following this approach
could you share me any simple thing from it? I want to understand preprocessor in more depth so I was thinking on looking into internals
Pavel
Just a doubt bothers me, if I make my own compiler then who will compile by compiler
Probably nobody will use a custom compiler made by someone unknown. Unless it will be advertised a lot as a good and fast compiler (better or faster than the existing ones)
asterix
I wrote a minimal implementation of clib / stdlib following this approach
hey I heard of libc, so basically it has everything what standards say & if i am not wrong then gcc or any compilers make use of libc
Cris
it was needed because our compiler library was lacking some implementations (about strings), and we wanted instead to write our code with full std::string support. unfortunately I cannot share it both because I don't have access to this code anymore, and because also if I did, I would not have the rights. But you can still browse open implementations and take inspiration: https://github.com/search?q=c+standard+library
Arusha98
hello everyone can anyone share with me , eclipse setup so that I can use to write and run code
der ðiβüśüɾę
do you know, where g++ source code?
der ðiβüśüɾę
I'm search about hour
der ðiβüśüɾę
Rahul
Hi
Anonymous
hello. anyone here can help me with my activity. c++ language.
Pavel
hello. anyone here can help me with my activity. c++ language.
Hi, this question is very vague, can you clarify what kind of help and with what exactly you need? dontasktoask.com
Anonymous
heres the problem. In the text file given a set of string that contains dashes (-) and asterisk (*) also known as bomb. the task is to count how many bombs can be found .
Anonymous
I've been doing this for two days but I can't get the right answer. Please help me.
kartik
Any code which in bat file to capture putty screen on windows after every command save to desktop directory
Damo
Hi
Damo
Can anyone solve nibble swap of a number in one line
Damo
In c
Anonymous
It's correct,hear am indicating that if the marks is outside that range (0-100),then it should revoke, display it's outside the range and to retry
That is because when you use continue, the loop counter will be incremented by 1 which is why you skip those values. Just type in --i before the continue and you would be good to go.
kartik
Hi all looking for c script or else which combines with putty , when run the command it will capture the screen of terminal all output in jpg format any one help request for all devlopers
Ambrose
I'm humbled to be here!
B121065_Swoyam Siddharth Nayak
#include<iostream> using namespace std; void swap(int arr[], int a, int b){ int temp=arr[a]; arr[a]=arr[b]; arr[b]=temp; } int pivot(int arr[], int f, int l){ int pi=arr[l]; int i=f-1; for(int j=f;j<l;j++){ if(arr[j]<pi){ i++; swap(arr, i, j); } } swap(arr, i+1, l); } void quicksort(int arr[], int f, int l){ if(f<l){ int mid=pivot(arr, f, l); quicksort(arr, f, mid-1); quicksort(arr, mid+1, l); } } int main(){ int n; cin>>n; int array[n]; for(int i=0;i<n;i++){ cin>>array[i]; } quicksort(array, 0, n-1); for(int i=0;i<n;i++){ cout<<array[i]<<" "; } return 0; } Whats wrong in this code of quick sort, am not getting any output
B121065_Swoyam Siddharth Nayak
like whats incorrect in that
Anonymous
It should be: #include <iostream>
B121065_Swoyam Siddharth Nayak
Anonymous
With a space between the e and the <
Ravi
Mistake should be in logic
Ravi
or either in swap function, try passing the referrence instead of the value of array
Ravi
Well I am not sure if it is call by reference or not, bt try call by reference
Anonymous
Hi
Anonymous
Write a program in C++ to find the square of 5 numbers that the user enters in an unary array
Anonymous
I am new here
Anonymous
I finish html😍
Darth
I finish html😍
Congratulations
Morgan
Hi I'm new here
Aura
Hi I'm new here
Oh man that name,
Aura
Welcome here though
Butterfly Around Wàist
/get
Butterfly Around Wàist
Sorry
Butterfly Around Wàist
I just click on this
Earl B
So, I am on the very last chapter of "Absolute Beginners Guide to C" and I have copied the code exactly, but for whatever reason my compiler is giving me an error. expected identifier or '(' before '{' token and will not build. I'm guessing it's because the book is old and not using c99 standards, but I would be happy if someone could maybe translate the code to c99 or something? Here's the code. // Example program #1 from Chapter 32 of Absolute Beginner's Guide // to C, 3rd Edition // File Chapter32ex1.c /* The program demonstrates functions returning a value by passing three floating-point numbers (grades) and calculating the average of the three. */ #include <stdio.h> float gradeAve(float test1, float test2, float test3); int main () { float grade1, grade2, grade3; float average; printf("What was the grade on the first test? "); scanf(" %f", &grade1); printf("What was the grade on the second test? "); scanf(" %f", &grade2); printf("What was the grade on the third test? "); scanf(" %f", &grade3); //Pass the three grades to the function and return the average average = gradeAve(grade1, grade2, grade3); printf("\nWith those three test scores, the average is %.2f", average); return 0; } float gradeAve(float test1, float test2, float test3); // Receives the values of three grades { float localAverage; localAverage = (test1 + test2 + test3)/3; return (localAverage); // returns average }
Anonymous
So, I am on the very last chapter of "Absolute Beginners Guide to C" and I have copied the code exactly, but for whatever reason my compiler is giving me an error. expected identifier or '(' before '{' token and will not build. I'm guessing it's because the book is old and not using c99 standards, but I would be happy if someone could maybe translate the code to c99 or something? Here's the code. // Example program #1 from Chapter 32 of Absolute Beginner's Guide // to C, 3rd Edition // File Chapter32ex1.c /* The program demonstrates functions returning a value by passing three floating-point numbers (grades) and calculating the average of the three. */ #include <stdio.h> float gradeAve(float test1, float test2, float test3); int main () { float grade1, grade2, grade3; float average; printf("What was the grade on the first test? "); scanf(" %f", &grade1); printf("What was the grade on the second test? "); scanf(" %f", &grade2); printf("What was the grade on the third test? "); scanf(" %f", &grade3); //Pass the three grades to the function and return the average average = gradeAve(grade1, grade2, grade3); printf("\nWith those three test scores, the average is %.2f", average); return 0; } float gradeAve(float test1, float test2, float test3); // Receives the values of three grades { float localAverage; localAverage = (test1 + test2 + test3)/3; return (localAverage); // returns average }
Does it tell u which line?
Earl B
Does it tell u which line?
yeah line 35, right before the float localAverage;
Anonymous
float gradeAve(float test1, float test2, float test3); <---- the book has ";" ?
Anonymous
#include <stdio.h> float gradeAve(float test1, float test2, float test3);
Anonymous
and the one without ; are not the same
Anonymous
perhaps you copied and pasted from the first line
Earl B
it's possible. whenever I copy from the book I have to do it line by line because it formats everything incorrectly. do different programming languages have more descriptive compiler error messages?
Anonymous
nope ... basically the first thing I look for is the immediate line above the error line reported
Anonymous
so once you say line 35 , my eyes went to the line above it
Earl B
good to know, I would imagine it would be really difficult to troubleshoot in a huge program without that trick. I'll definitely be adopting that
HaiNahi
Anyone know android studio how to draw pixels on it
Diego
If you take a screenshot and fire up mspaint you can draw pixels on it
HaiNahi
Lol android app I want to make
HaiNahi
I used SDL to develop apps for desktop now I want for android
Diego
https://skia.org/
Anonymous
Thanks fr adding me
Anonymous
Hi guys c++ has any standard library or macros to generate reports and graphs at run time?
Anonymous
hola