0

how many bytes can a CF function be?

ColdFusion
Apparently, the answer is 65535 bytes.

I had a huge laugh today when we got this error...

"500 cfReports2ecfc1683660545$funcRUN (Code of a method longer than 65535 bytes) cfReports2ecfc1683660545$funcRUN (Code of a method longer than 65535 bytes)"

... when trying to run a function I had just refactored for some inherited code. It had the dreaded problem that none of the function-local variables were scoped. So, I dutifully added cfset Var local = StructNew() to the top of the function and spent about 4 hours prepending all relevant variables with "local."

then, we got this error and noticed the huge, complex function has 2189 lines of CF code. I'm guessing CF server was able to compile the code, but just isn't allowed to run a function larger than 65535 byte.

Has anyone else ever seen this? (i did a short Google session, but didn't turn up anything)

Yes, I know this function needs to be rewritten badly to shorter functions, yadda, yadda... but I couldn't help sharing.
tags:
ColdFusion
Ben Nadel said:
 
That's too funny! I've never seen that error before.
 
posted 367 days ago
Add Comment Reply to: this comment OR this thread
 
Steven Erat said:
 
The error message for this has improved over previous versions which used to report simply "unexpected constant".
See: http://tinyurl.com/6dzeuq

A workaround, at that time at least, was to cfinclude blocks of code into the function instead of having all the literal text within the function.

 
posted 367 days ago
Add Comment Reply to: this comment OR this thread
 
Matt Woodward said:
 
 
posted 367 days ago
View Replies (3) || Add Comment Reply to: this comment OR this thread
 
.: HIDE REPLIES :.
Peter Bell said:
 
I was gonna mention Matts post, but looks like he beat me to it. I've also come across this before - but it was a long time ago and I was drunk when I wrote it - honest :-)
 
posted 366 days ago
Add Comment Reply to: this comment OR this thread
 
Matt Woodward said:
 
Who you callin' drunk? ;-)
 
posted 366 days ago
Add Comment Reply to: this comment OR this thread
 
Peter Bell said:
 
@Matt, Me! I found your post about running into the problem, but me being drunk was referring to my justification for once having written such a monstrosity myself.
 
posted 366 days ago
Add Comment Reply to: this comment OR this thread
 
cfZen said:
 
@Ben - I'm glad I could "brighten" your day, and that even someone like you hasn't seen it.

@Steven - we refactored it just enough so far to be under the 64K size limit (just barely, cuz we got bigger fish to fry at the moment)

@Matt - I assume you meant http://www.mattwoodward.com/blog/index.cfm?event=s...
 
posted 366 days ago
View Replies (1) || Add Comment Reply to: this comment OR this thread
 
.: HIDE REPLIES :.
cfZen said:
 
@Matt - oh darn, I see instantspot software is cutting off our URLs (explaining why your URL was wrong, too)... my first try at tinyurl should solve it: http://tinyurl.com/5lo6wg

@all - who's going to MAX Europe? Let's follow Matt's drinking patterns, and I'll buy you a beer for ...er... posting to my blog... ;-}
 
posted 366 days ago
Add Comment Reply to: this comment OR this thread
 
WOW gold said:
 
 
posted 213 days ago
Add Comment Reply to: this comment OR this thread
 

Search

Aaron  Longnion

The Hague, NL