News for hackers. Stuff that matters.
Re:PH7 – An Embedded Implementation of PHP (C Library) by unwind on Wednesday February 19, 2014 @11:23AM (#7264337)
On the other hand, the single-source engine is so large, GitHub won't display it on the web. :/
Re:PH7 – An Embedded Implementation of PHP (C Library) by eksith on Wednesday February 19, 2014 @11:36AM (#7264424)
I was curious why they did that. Just looked at the source and came across this :

  This file is an amalgamation of many separate C source files from PH7 version 2.1.
  By combining all the individual C code files into this single large file, the entire code
  can be compiled as a single translation unit.This allows many compilers to do optimization's
  that would not be possible if the files were compiled separately.Performance improvements
  are commonly seen when PH7 is compiled as a single translation unit.
The target does say for embedded so I guess that's from experience running this on very small resources.
Re:PH7 – An Embedded Implementation of PHP (C Library) by unwind on Wednesday February 19, 2014 @11:41AM (#7264450)
But the glueing together destroys any modularization they had going on, making the code way harder for anyone else to understand and read.

The "typical" solution to that very valid problem is to use the preprocessor, i.e. create a "ph7-master.c" file that simply includes all the real C files.

The comparative overhead of should be negligble, but then the modularization survives.

Re:PH7 – An Embedded Implementation of PHP (C Library) by Touche on Wednesday February 19, 2014 @11:44AM (#7264470)
Or use cat to combine the files prior to compiling.
Re:PH7 – An Embedded Implementation of PHP (C Library) by symisc_devel on Wednesday February 19, 2014 @11:31AM (#7264394)
SQLite style: The amalgamation is a single C code file, that contains all C code for the core. With one big unit, the compiler can perform several smart optimizations that cannot be done if the source code was split between different C files.
Re:PH7 – An Embedded Implementation of PHP (C Library) by 72deluxe on Wednesday February 19, 2014 @11:49AM (#7264504)
Also makes it dead easy to download and embed into projects! Hurray for single source files.