Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

C Is Not a Low-level Language. Your computer is not a fast PDP-11

Name: Anonymous 2018-10-18 20:01

For a language to be "close to the metal," it must provide an abstract machine that maps easily to the abstractions exposed by the target platform. It's easy to argue that C was a low-level language for the PDP-11.

it is possible to make C code run quickly but only by spending thousands of person-years building a sufficiently smart compiler—and even then, only if you violate some of the language rules. Compiler writers let C programmers pretend that they are writing code that is "close to the metal" but must then generate machine code that has very different behavior if they want C programmers to keep believing that they are using a fast language.

https://queue.acm.org/detail.cfm?id=3212479

Name: Anonymous 2018-10-18 21:12

C is not a low-level language
Who says it is? It's not.

Name: Anonymous 2018-10-18 21:15

>>2
Do you know any "low-level" language then?

Name: Anonymous 2018-10-18 21:17

>>3
assembly

Name: Anonymous 2018-10-18 22:23

>>3
VHDL

Name: Anonymous 2018-10-18 23:34

>>3
FORTRAN

Name: Anonymous 2018-10-18 23:38

>>3
binary

Name: Anonymous 2018-10-19 1:59

>>3
WebGL =3

Name: Anonymous 2018-10-19 4:59

Forth is lower-level than C, but its much slower in practice.
C/C++ dominate all low-level software.
C/C++ Inline assembler allows writing low-level stuff easily.

Name: Anonymous 2018-10-19 5:09

>>9
but its much slower in practice
the more popular a language is, the more people there are to make it better, including performance optimizations

see: JVM, which is not as slow as people say it is

Name: Anonymous 2018-10-19 12:27

>>10
Forth is inherently limited by register machines, forth is optimized for stack processors(promoted by Charles Moore) https://en.wikipedia.org/wiki/Charles_H._Moore

Name: Anonymous 2018-10-19 13:19

int redPin=11;
int greenPin=10;
int bluePin=9;
int buzzerPin=7;

int potPin=1;
int sensorPin=7;

long red=0xFF0000;
long green=0x00FF00;
long blue =0x000080;
int band =50;
void setup()
{
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin,OUTPUT);
pinMode(buzzerPin,OUTPUT);
}
void loop()
{
int gsr = analogRead(sensorPin);
int pot = analogRead(potPin);
if (gsr > pot + band)
{setColor(red);
beep();
}
else if (gsr <pot -band)
{
setColor(red);
beep();
}
else if (gsr <pot - band)
{
setColor(blue);
}
else
{
setColor(green);
}
}
void setColor(long rgb)
{
int red=rgb >> 16;
int green=(rgb>>8) & 0xFF;
int blue = rgb & 0xFF;
analogWrite(redPin, red);
analogWrite(greenPin, green);
analogWrite(bluePin, blue);
}
void beep()
{
for(int i = 0;i < 1000; i++)
{
digitalWrite(buzzerPin, HIGH);
delayMicroseconds(100);
digitalWrite(buzzerPin, LOW);
delayMicroseconds(100);
}
}

Name: Anonymous 2018-10-19 18:08

>>12
no indentation ew what the fuck
also use [code] tags

Name: Anonymous 2018-10-19 18:12

>>13
No, should have used monospace + keep the spaces.

Name: Anonymous 2018-10-19 18:21

>>14
no, [code] tags are for code
I swear, retards will argue about anything on this board

Name: Anonymous 2018-10-19 18:35

>>15
No they don't!

Name: Anonymous 2018-10-19 22:11

>>12
}
else if (gsr <pot -band)
{
setColor(red);
beep();
}
else if (gsr <pot - band)
{
setColor(blue);
}
what are you doing

Name: Anonymous 2018-10-20 12:50

>>15
[code] tags are for code
And? There is no reason for them to exist.

Name: Anonymous 2018-10-20 13:04

ln(1+x) = x - x^2/2 + x^3/3 ...
ln(2) = 1 - 1/2 + 1/3 - 1/4 + 1/5 ...

x - x^2/2 + x^3/3 ...
log2(x+1) = ------------------------------
1 - 1/2 + 1/3 - 1/4 + 1/5 ...

Name: Anonymous 2018-10-20 13:24

>>19
ln(1+x) = x - x^2/2 + x^3/3 ...
Does not converge for x > 1. Also, wrong thread, read http://lolengine.net/blog/2011/12/21/better-function-approximations and there are better methods anyway for computing logarithms.

Don't change these.
Name: Email:
Entire Thread Thread List