Go to advanced search

by jahboater
Sat Nov 14, 2020 11:16 am
Forum: Beginners
Topic: Source Code question (noob)
Replies: 7
Views: 413

Re: Source Code question (noob)

Is there any limitations with using source code builds on a rpi other than it not running well due to the low powered hardware If anything, a program built from source should run faster. For example, programs distributed with the 32-bit Raspberry Pi OS are compiled for the ARMv6 - to support the ol...
by jahboater
Sat Nov 14, 2020 10:50 am
Forum: Off topic discussion
Topic: Access Raspbian disk from WIndows
Replies: 31
Views: 1773

Re: Access Raspbian disk from WIndows

Once I have pulled all that together, I'll set it up and check if it works, and then store it in a safe place. When I run into a disk problem with my main R-Pi 4, I can simply slip it's sd card into the reader and repair the error... and stay away from Windows! :D You do not need a second Pi! But y...
by jahboater
Sat Nov 14, 2020 10:06 am
Forum: Beginners
Topic: Source Code question (noob)
Replies: 7
Views: 413

Re: Source Code question (noob)

There is the standard mantra:

./configure && make && sudo make install

The && means "only start the next step if the previous step succeeded".
by jahboater
Sat Nov 14, 2020 9:00 am
Forum: Python
Topic: Whats the best way to install 3.8?
Replies: 19
Views: 999

Re: Whats the best way to install 3.8?

The latest stable release is 3.9 at the time of writing. Download the source from here: https://www.python.org/downloads/source/ To install a source release is easy: tar xf Python-3.9.0.tar.xz cd Python-3.9.0 ./configure --enable-optimizations make sudo make install Run "python3" to check you have t...
by jahboater
Sat Nov 14, 2020 5:57 am
Forum: Advanced users
Topic: Different stress tests producing different results?
Replies: 3
Views: 255

Re: Different stress tests producing different results?

The Sysbench had my CPU max at about 60C for my overclock (2GHz) while stress-ng had it doing above 80C and throttling. Why are the two tests giving such different results, and which one should I use to decide if I have a good overclock? Different instruction mixes will heat up the CPU by differing...
by jahboater
Fri Nov 13, 2020 8:53 pm
Forum: Other projects
Topic: A Birthday Present for Fido
Replies: 381
Views: 15799

Re: A Birthday Present for Fido

Heater wrote:
Fri Nov 13, 2020 8:44 pm
My new code will likely use stdbool.h. But my new code may well be calling out to old code with it's own idea of "bool".
Perhaps I should have said "code in a new project".
by jahboater
Fri Nov 13, 2020 8:29 pm
Forum: Other projects
Topic: A Birthday Present for Fido
Replies: 381
Views: 15799

Re: A Birthday Present for Fido

Until you are writing modern C and use "bool" because you cannot stand the aesthetics of "_Bool" but find yourself calling old code with it's own idea of what "bool" might mean. No. That's the whole point of the optional header file. Don't add the #include if you have an existing definition of bool...
by jahboater
Fri Nov 13, 2020 8:15 pm
Forum: Other projects
Topic: A Birthday Present for Fido
Replies: 381
Views: 15799

Re: A Birthday Present for Fido

As such, everyone of those 51 C compilers could actually implement a different language. Looks like C, compiles the same source, but may well behave very differently than the C you are using. The ISO standards have been around for long time now, and respectable modern compilers support them. How a ...
by jahboater
Fri Nov 13, 2020 8:05 pm
Forum: Other projects
Topic: A Birthday Present for Fido
Replies: 381
Views: 15799

Re: A Birthday Present for Fido

In my opinion, this popularity and diversity would not have been possible if C did not include a simple preprocessor that allowed developers to adapt existing code to a new system while retaining compatibility with the environment in which it originally ran. I think macro processors (for example wh...
by jahboater
Thu Nov 12, 2020 7:14 pm
Forum: Other projects
Topic: A Birthday Present for Fido
Replies: 381
Views: 15799

Re: A Birthday Present for Fido

I think that is a classic example of what I hate to see in C. A bunch of compiler specific noise. Exactly!! Precisely. The macro removed all that and made the actual code both readable and portable. So I can write plain "unused int num" You may hide all the nasty compiler specific stuff in a header...
by jahboater
Thu Nov 12, 2020 7:01 pm
Forum: General discussion
Topic: To Buy or Not To Buy
Replies: 26
Views: 844

Re: To Buy or Not To Buy

Any Pi you buy that will handle the tasks you have in mind for it will *continue* to handle those tasks no matter what some future Pi is capable of. Just because a better Pi comes along doesn't mean the Pi you already have degrades. That's the rational argument. Suppose you buy a Pi3 for use as a g...
by jahboater
Thu Nov 12, 2020 6:46 pm
Forum: General discussion
Topic: To Buy or Not To Buy
Replies: 26
Views: 844

Re: To Buy or Not To Buy

Speaking as someone who got caught out by the launch of the B+ (bought a 1B a day or two before it) I look at it this way: the one you bought still does eveything it did yesterday, if it was the right tool for the job that hasn't changed. New models of lots of stuff arrive, if you're always waiting...
by jahboater
Thu Nov 12, 2020 6:32 pm
Forum: Other projects
Topic: A Birthday Present for Fido
Replies: 381
Views: 15799

Re: A Birthday Present for Fido

To my mind C does not have a macro facility. It has a rude and crude text substitution mechanism. Does that really count as "macros"? Do you mean like C does not have strings? Yet I'm guessing more text processing code has been written in C over the decades than in all other languages put together ...
by jahboater
Thu Nov 12, 2020 12:54 am
Forum: Other projects
Topic: A Birthday Present for Fido
Replies: 381
Views: 15799

Re: A Birthday Present for Fido

I'm not sure whether this is a bug or not, Since it is undefined behavior, anything may happen - it might crash, produce the wrong answer, produce the right answer, do nothing at all, etc. I think both compilers are correct. GCC does this: .LC0: .ascii "v[1000] = %d\012\000" .align 2 .global main ....
by jahboater
Wed Nov 11, 2020 11:33 pm
Forum: Other projects
Topic: A Birthday Present for Fido
Replies: 381
Views: 15799

Re: A Birthday Present for Fido

./range.go:6:3: invalid array index 1000 (out of bounds for 6-element array) make: *** [Makefile:2: range] Error 2 I found the error message to be nice and descriptive. Yes indeed. I eventually managed to get C to complain. In this code: int v[6]; v[1000] = 1; // asm( "" ::: "memory" ); printf("v[1...
by jahboater
Wed Nov 11, 2020 6:22 pm
Forum: Other projects
Topic: A Birthday Present for Fido
Replies: 381
Views: 15799

Re: A Birthday Present for Fido

In general it will behave as if the function returned whatever value was in register R0 at the point of return. I think that's exactly what does happen - not sure about the phrase "as if". Whatever happens to be in R0 (ARM32), X0 (Aarch64), RAX (x86_64) is the return value. Inlined functions are a ...
by jahboater
Wed Nov 11, 2020 1:58 pm
Forum: C/C++
Topic: Memory Protection Settings (sys/mman.h)
Replies: 10
Views: 456

Re: Memory Protection Settings (sys/mman.h)

I've not heard of such an error, what is the exact error message gcc is giving you and can you provide a small example program that exhibits this error (including your compile command)? My suspicion is that this is a C++ language problem. There is no such documented error return from either function.
by jahboater
Wed Nov 11, 2020 11:49 am
Forum: Other projects
Topic: A Birthday Present for Fido
Replies: 381
Views: 15799

Re: A Birthday Present for Fido

Paeryn wrote:
Wed Nov 11, 2020 11:35 am
The only thing you can count on is that you can't count on it being a meaningful value.
Fortunately GCC complains about that:

error: control reaches end of non-void function [-Werror=return-type]
by jahboater
Wed Nov 11, 2020 8:21 am
Forum: Other projects
Topic: A Birthday Present for Fido
Replies: 381
Views: 15799

Re: A Birthday Present for Fido

ejolson wrote:
Wed Nov 11, 2020 6:51 am
Okay, having experimented with gcc version 9.3 a little bit, it would appear
  • Without -Wall
  • All such functions return 0 by default.
Just to be clear, that's only if they are called "main".

What about normal optimization levels ? -O3 say.
by jahboater
Wed Nov 11, 2020 6:36 am
Forum: Other projects
Topic: A Birthday Present for Fido
Replies: 381
Views: 15799

Re: A Birthday Present for Fido

Special casing the function called main seems odd. What happens if you have a function called static int main() in another file? Does it also return zero by default? Looks like it does for -O0 only (may be a bug), other optimization levels elide the static one. It complains about main() being stati...
by jahboater
Wed Nov 11, 2020 5:18 am
Forum: Other projects
Topic: A Birthday Present for Fido
Replies: 381
Views: 15799

Re: A Birthday Present for Fido

Since when did main return zero by default? I think since C99, over twenty years ago. Is this the default for all integer valued functions? No, only main. Main() must return a value to the OS It does the equivalent of: exit( main() ); Does main in clang also return zero be default? Yes. It is part ...
by jahboater
Wed Nov 11, 2020 4:27 am
Forum: Troubleshooting
Topic: Pi 4 automatically reboots upon heavy load when moderately overclocked
Replies: 10
Views: 402

Re: Pi 4 automatically reboots upon heavy load when moderately overclocked

You can monitor the temperature of the PMIC with:

Code: Select all

vcgencmd measure_temp pmic
by jahboater
Wed Nov 11, 2020 4:16 am
Forum: Other projects
Topic: A Birthday Present for Fido
Replies: 381
Views: 15799

Re: A Birthday Present for Fido

The little C program:

Code: Select all

int
main( void )
{
  char array[6];
  array[1000] = 'x';
}
compiles to this on the Pi aarch64 (sans a little red tape):

Code: Select all

   .global main
main:
   mov  w0, 0
   ret
:) which works fine :)

(main() returns zero by default)
by jahboater
Tue Nov 10, 2020 8:00 pm
Forum: Off topic discussion
Topic: What was your first computer?
Replies: 567
Views: 230152

Re: What was your first computer?

Heater, I was there the day it was delivered to our university, two or three huge trucks stopped outside the CS building, an aluminium "road way" was laid down from the back of trucks, into through the front door and into the bowels of the CS department. Then a procession of gorgeous looking bight o...
by jahboater
Tue Nov 10, 2020 7:32 pm
Forum: Other projects
Topic: A Birthday Present for Fido
Replies: 381
Views: 15799

Re: A Birthday Present for Fido

It appears the constraints force a clarity of expression with a net result that positively balances the negative of the constraint. When writing C in a hurry, or for a throw-away program, I allocate "plenty" of memory (after all, my Pi4 has 8GB why worry about a few KB? and why spend ages calculati...

Go to advanced search